Expand description
Primality and factorization. is_prime is a deterministic Miller–Rabin (the
witness set {2,3,5,…,37} is proven correct for all of u64), and prime_factors
uses trial division for small factors then Pollard’s rho (Brent’s variant) for
the rest, so factorization is correct across the full u64 range — not just up to
√n.
Functions§
- divisors
- All positive divisors of
n, ascending.[1]forn = 1; empty forn = 0. - is_
prime - Deterministic Miller–Rabin primality test, exact for all
u64. - next_
prime - The smallest prime strictly greater than
n. - prime_
factors - Prime factorization as
(prime, exponent)pairs, ascending by prime. Empty forn < 2(0 and 1 have no prime factorization).