bigi
bigi copied to clipboard
Primality test can return true for composites
It appears the Miller-Rabin test implemented in bigi always chooses the base from the set of primes < 1000, however it is possible to construct a composite that appears prime relative to any fixed set of witnesses, and the paper https://math.dartmouth.edu/~carlp/PDF/reliable.pdf has a proof that there exist integers with no small witnesses at all.
The best fix is probably to choose the witnesses randomly from the range [2,n) which avoids the problem entirely.
The better option is probably to deprecate it and remove it? This library isn't actively developed - only maintained - cautiously.