Some question about prime numbers and gmp

Pierre Chatelier ktd at club-internet.fr
Sat Dec 20 18:53:20 UTC 2014


Hello,

I miss a few information about prime numbers in gmp. Here are my questions :

-what is behaviour to expect for negative integers with mpz_probab_prime_p/mpz_nextprime ? Currently, mpz_probab_prime_p seems to work as with the absolute value, while nextprime returns 2. Is it a behaviour that could change in future releases ?

-mpz_probab_prime_p has the "int reps" parameter, while "mpz_nextprime" does not. Does "mpz_nextprime" use internally a default "reps" value ?
More specifically, it there a minimum "reps" value that can guarantee that, for any prime P, mpz_probab_prime_p() won't return any "maybe" for any number between P and mpz_nextprime(P) ?

-for some values of "reps" (i.e. 25), is there a known number N which is the first one for which mpz_probab_prime_p(N) returns "maybe" though the known right answer is "No" ? Thus, we could assume that every "maybe" answer of mpz_probab_prime_p(..., reps) for numbers less than N is just a plain "Yes".

-Let's says that I spend a few hours (days) running gmp, and find that the nth prime P (so far in the computation), according to GMP, is indeed the real nth prime (according to https://primes.utm.edu for instance). Then, I could assume that every "maybe" answer of mpz_probab_prime_p() for numbers less than P is just a plain "Yes".
Has anybody published such numbers anywhere ?

Regards,

Pierre Chatelier


More information about the gmp-discuss mailing list