Re: question on execution time for qfbsolve

Bill Allombert <[email protected]>
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <aGYvO8Qrc-2z5wir@seventeen>
On Wed, Jul 02, 2025 at 08:14:09PM -0700, American Citizen wrote:
> I ran over the first 100,000 integers
> 
> ? for(i=1,100000,qfbsolve(Qfb(1,0,1),i,3))
> cpu time = 3,394 ms, real time = 3,394 ms.
> ? for(i=1,100000,qfbsolve(Qfb(1,0,1),[i,factor(i)],3))
> cpu time = 3,348 ms, real time = 3,348 ms.
> 
> so it is about the same, not much improvement, 46 milliseconds.

Of course since you are including the time to factor i!

The point is to avoid factoring i again when its factorization is already
known.

For example:

? #
? forfactored(i=1,1000000,qfbsolve(Qfb(1,0,1),i,3))
  ***   last result computed in 2,767 ms.
? for(i=1,1000000,qfbsolve(Qfb(1,0,1),i,3))
  ***   last result computed in 2,994 ms.
? for(i=1,1000000,qfbsolve(Qfb(1,0,1),[i,factor(i)],3))
  ***   last result computed in 3,131 ms.

Of course for small numbers, it should not make a lot of difference.

Cheers,
Bill.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.