Skip to main content

Module integer_factorization

Module integer_factorization 

Source
Expand description

Factorization of 64-bit integers.

See the book entry Primes: sieves, Miller–Rabin and factorisation.

Functions§

divisors
All positive divisors of n ≥ 1, sorted.
euler_totient
Euler’s totient φ(n), from the factorization.
factorize
The prime factorization of n ≥ 1 as (prime, exponent) pairs in increasing order (empty for 1, and for 0, which has no factorization). Small factors are removed by trial division, the remainder is split recursively with Pollard’s rho and certified by deterministic Miller-Rabin. Any u64 factors in milliseconds.
pollard_rho
A non-trivial factor of the odd composite n by Pollard’s rho with Brent’s cycle detection and batched gcds, iterating x ← x² + c for successive c.