Miller-Rabin and 0

1
closed
casperes1996
casperes1996
Posted 10 months ago

Miller-Rabin and 0 #333

In the algorithm for the Miller-Rabin primality test, 0 is reported as a prime. 0 should be special-cased by an initial "if 0 return false;" check. One can argue 0 is just invalid input for the algorithm, but I would then argue at least throwing an assert error on 0 input is preferable so it becomes clear to anyone reading or potentially copying the algorithm for primality testing that 0 is not a prime but not accounted for in the current algorithm logic.

siriak
siriak
Created 9 months ago

Done