Karim Belabas on Sun, 12 May 2024 18:11:30 +0200


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

Re: p=randomprime(2^2000) is significantly slower than isprime(p)


* Georgi Guninski [2024-05-12 11:45]:
[...]
> isprime(p) is slower than randomprime(p):

Which makes sense since randomprime() only performs a strong pseudoprimality
proof and not a full primality proof. See ?? randomprime

Cheers,

    K.B.

> ? default(timer,1)
> ? setrand(1)
> ? p=randomprime(2^2000)
> time = 747 ms.
> ? isprime(p)
> time = 14,758 ms.
> %4 = 1
> ? ispseudoprime(p)
> time = 40 ms.
> %5 = 1
-- 
Pr. Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/