pub fn pollard_rho_factorize(
    mut number: u64,
    seed: &mut u32,
    primes: &[usize],
    minimum_prime_factors: &[usize],
) -> Vec<u64> {
    if number <= 1 {
        return vec![];
    }
    let mut result: Vec<u64> = Vec::new();
    {
        // Create a new scope to keep the outer scope clean
        let (rem, mut res) = get_small_factors(number, primes);
        number = rem;
        result.append(&mut res);
    }
    if number == 1 {
        return result;
    }
    let mut to_be_factored = vec![number];
    while !to_be_factored.is_empty() {
        let last = to_be_factored.pop().unwrap();
        if last < minimum_prime_factors.len() as u64 {
            result.append(&mut factor_using_mpf(last as usize, minimum_prime_factors));
            continue;
        }
        let fact = pollard_rho_get_one_factor(last, seed, true);
        if fact == last {
            result.push(last);
            continue;
        }
        to_be_factored.push(fact);
        to_be_factored.push(last / fact);
    }
    result.sort_unstable();
    result
}
/*
`primes` and `minimum_prime_factors` use usize because so does
LinearSieve implementation in this repository
 */
`primes` and `minimum_prime_factors` use usize because so does
LinearSieve implementation in this repository
` primes ` and ` minimum_prime_factors ` use usize because so does LinearSieve implementation in this repository
pub fn pollard_rho_factorize(
    mut number: u64,
    seed: &mut u32,
    primes: &[usize],
    minimum_prime_factors: &[usize],
) -> Vec<u64> {
    if number <= 1 {
        return vec![];
    }
    let mut result: Vec<u64> = Vec::new();
    {
        // Create a new scope to keep the outer scope clean
        let (rem, mut res) = get_small_factors(number, primes);
        number = rem;
        result.append(&mut res);
    }
    if number == 1 {
        return result;
    }
    let mut to_be_factored = vec![number];
    while !to_be_factored.is_empty() {
        let last = to_be_factored.pop().unwrap();
        if last < minimum_prime_factors.len() as u64 {
            result.append(&mut factor_using_mpf(last as usize, minimum_prime_factors));
            continue;
        }
        let fact = pollard_rho_get_one_factor(last, seed, true);
        if fact == last {
            result.push(last);
            continue;
        }
        to_be_factored.push(fact);
        to_be_factored.push(last / fact);
    }
    result.sort_unstable();
    result
}
pub fn pollard_rho_factorize ( mut number : u64 , seed : & mut u32 , primes : & [ usize ] , minimum_prime_factors : & [ usize ] , ) -> Vec < u64 > { if number <= 1 { return vec ! [ ] ; } let mut result : Vec < u64 > = Vec :: new ( ) ; { // Create a new scope to keep the outer scope clean let ( rem , mut res ) = get_small_factors ( number , primes ) ; number = rem ; result . append ( & mut res ) ; } if number == 1 { return result ; } let mut to_be_factored = vec ! [ number ] ; while ! to_be_factored . is_empty ( ) { let last = to_be_factored . pop ( ) . unwrap ( ) ; if last < minimum_prime_factors . len ( ) as u64 { result . append ( & mut factor_using_mpf ( last as usize , minimum_prime_factors ) ) ; continue ; } let fact = pollard_rho_get_one_factor ( last , seed , true ) ; if fact == last { result . push ( last ) ; continue ; } to_be_factored . push ( fact ) ; to_be_factored . push ( last / fact ) ; } result . sort_unstable ( ) ; result }
`primes` and `minimum_prime_factors` use usize because so does
LinearSieve implementation in this repository
` primes ` and ` minimum_prime_factors ` use usize because so does LinearSieve implementation in this repository
number
u64
seed
&mut u32
primes
&[usize]
minimum_prime_factors
&[usize]
number
u64
seed
&mut u32
primes
&[usize]
minimum_prime_factors
&[usize]