Expand description
Deterministic primality testing for 64-bit integers.
See the book entry Primes: sieves, Miller–Rabin and factorisation.
Functions§
- is_
prime - Deterministic primality for every
u64: Miller-Rabin with the first twelve prime bases, whose smallest common strong pseudoprime is 318 665 857 834 031 151 167 461 ≈ 3.2 · 10²³ (Sorenson and Webster, 2015), far aboveu64::MAX≈ 1.8 · 10¹⁹, after trial division by small primes. - is_
strong_ probable_ prime - Whether
npasses the Miller-Rabin strong probable-prime test to basea. - mul_mod
a · b mod mwithout overflow.- next_
prime - The smallest prime
≥ n(Nonepast the largest 64-bit prime). - pow_mod
base^exponent mod mby binary exponentiation (m > 0).