diff --git a/src/math/miller_rabin.rs b/src/math/miller_rabin.rs index 14e4694c838..650222e2a39 100644 --- a/src/math/miller_rabin.rs +++ b/src/math/miller_rabin.rs @@ -40,6 +40,9 @@ pub fn miller_rabin(number: u64, bases: &[u64]) -> u64 { // note that all bases should be prime if number <= 4 { match number { + 0 => { + panic!("0 is invalid input for Miller-Rabin. 0 is not prime by definition, but has no witness"); + } 2 => return 0, 3 => return 0, _ => return number,