New code for primality testing

Marco Bodrato bodrato at mail.dm.unipi.it
Wed Nov 21 19:05:18 UTC 2018


Ciao,

Il Dom, 18 Novembre 2018 12:47 pm, Marco Bodrato ha scritto:
> Il Sab, 17 Novembre 2018 11:58 am, Adrien Prost-Boucle ha scritto:
>>   mpz_prime_mersenne2_p(int p)         // the Mersenne number is 2^p-1

> I'd suggest to hard-code a list of the already known primes, return 2 if
> the value is in the list, 0 otherwise, and call the generic functions
> if p is out of range :-) It would be very fast up to some millions of
> digits! And too slow (as expected) for larger numbers :-D

Il Mer, 21 Novembre 2018 12:02 pm, Torbjörn Granlund ha scritto:
> Paul Leyland <paul.leyland at gmail.com> writes:
>   ... but please use table look-up for small exponents (under 30M or

> I table of known exponents, and then just a lookup there?  Cute idea.

A hard-coded table, I'm happy to see that we all agree on the proposed
strategy for Mersenne's numbers :-)

But what about other functions? Should we add to the API functions that
perform specific tests?

Ĝis,
m

-- 
http://bodrato.it/papers/



More information about the gmp-devel mailing list