Unclear "15" in doc for mpz_probab_prime_p

Paul Eggert eggert at cs.ucla.edu
Fri Jun 13 21:22:19 CEST 2025


Currently gmp.texi says this about mpz_probab_prime_p:

"This function performs some trial divisions, a Baillie-PSW probable 
prime test, then @var{reps-24} Miller-Rabin probabilistic primality 
tests.... Reasonable values of @var{reps} are between 15 and 50."

That "15" is confusing because all reps values < 25 behave the same.

The simplest fix I can think of is to change "15" to "24" in the 
documentation. Alternatively we could add an explanation for the "15"; I 
assume it's for portability to GMP 6.1.2 (2016) and earlier, but it's 
not clear that the extra wording would be worth the trouble nowadays.

Also, two lines earlier in gmp.texi I suggest changing "A composite 
number" to "A randomly chosen composite number" to emphasize that GMP 
doesn't guarantee resistance to large composite numbers that were 
generated by an adversary.


More information about the gmp-bugs mailing list