[][src]Function red_primality::factor

pub fn factor(n: u64) -> PrimeFactorization

Determines the prime factors of a given u64.

This function uses a few iterations of trial division, then switches to Pollard's rho algorithm. The algorithm is not deterministic, but On my laptop it averages less than 100ms for products of two factors slightly smaller than 2^32, which is the expected worst case scenario.

Panics

This function will panic if it attempts to factor 0.