GMP issue with mpz_nextprime()
tg at gmplib.org
Tue Jan 14 11:21:06 UTC 2020
simondev1 <scavegn at gmx.ch> writes:
Found non-prime with method mpz_nextprime:
GMP Version 4.31(probably)
We have never released any 4.31. (There was a 4.3.1 made 11 years ago,
but the bug you report was fixed there already.)
p = 2028576353201;
mpz_nextprime(p, p); // this will find 2028576353203 which is not prime.
I assume the number of repetitions for the probablyprime test inside
mpz_nextprime() is too low. Probablyprime with 5 repetitions say its
probably a prime, 6 repetitions already find this number is not a
prime. Suggestion would be increase the number of repetitions from
about 5 to about 7..20? And add an overload where one can specify
number of repetitions? (Some apps need speed, some need certainity.)
Or add 2028576353203 (and the number of repetitions) to documentation of mpz_nextprime().
This bug was fixed more than 10 years (and countless releases!) ago.
Please encrypt, key id 0xC8601622
More information about the gmp-bugs