hermann on Tue, 24 Feb 2026 16:38:18 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Why does factorint() take 128ms for 1853 decimal digit prime, while isprime() takes 16:45min/2min cpu/real time?


On 2026-02-24 14:46, Karim Belabas wrote:
But I should have learned about it myself easily with "??factorint".

Maybe I'm missing something but this seems to be easy to find:

14:38) gp > ??factorint
factorint(x,{flag = 0}):

Factors the integer n into a product of pseudoprimes (see ispseudoprime),
[...]
the divisors are by default not proven primes if they are larger than 2^64, they only failed the BPSW compositeness test (see ispseudoprime). Use isprime on the result if you want to guarantee primality or set the factor_proven
default  to 1.
[...]


N.B. I don't recommend setting that default outside validating a specific
computation (then unsetting it again). It may slow down gp considerably
in ways which are hard to predict or mitigate for users.

Cheers,

    K.B.

You are right, easy to find, and that was what I tried to say with my last posting.

Regards,

Hermann.