fn binomial_factors(s: &primal::Sieve, n: usize, k: usize) -> Vec<(usize, usize)> {
    assert!(n >= k);

    // Compute n!/k!(n - k)!

    // n!
    let mut nf = factorial_factors(&s, n);

    // k!(n - k)!
    let mut kf = factorial_factors(&s, k);
    combine_factors(&mut kf, &factorial_factors(&s, n - k));

    // Reduce common factors
    reduce_factors(&mut nf, &kf);

    nf
}
/// Compute the binomial coefficient as a list of factors
Compute the binomial coefficient as a list of factors
Compute the binomial coefficient as a list of factors
fn binomial_factors(s: &primal::Sieve, n: usize, k: usize) -> Vec<(usize, usize)> {
    assert!(n >= k);
    // Compute n!/k!(n - k)!
    // n!
    let mut nf = factorial_factors(&s, n);
    // k!(n - k)!
    let mut kf = factorial_factors(&s, k);
    combine_factors(&mut kf, &factorial_factors(&s, n - k));
    // Reduce common factors
    reduce_factors(&mut nf, &kf);
    nf
}
fn binomial_factors ( s : & primal :: Sieve , n : usize , k : usize ) -> Vec < ( usize , usize ) > { assert ! ( n k ) ; // Compute n!/k!(n - k)! // n! let mut nf = factorial_factors ( & s , n ) ; // k!(n - k)! let mut kf = factorial_factors ( & s , k ) ; combine_factors ( & mut kf , & factorial_factors ( & s , n - k ) ) ; // Reduce common factors reduce_factors ( & mut nf , & kf ) ; nf }
Compute the binomial coefficient as a list of factors
Compute the binomial coefficient as a list of factors
s
&primal::Sieve
n
usize
k
usize