Skip to main content

binomial

Function binomial 

Source
pub fn binomial(n: u64, k: u64) -> BigUint
Expand description

n choose k via the multiplicative formula (0 when k > n).

ยงExamples

use num_bigint::BigUint;
use sim_lib_discrete_comb::binomial;

assert_eq!(binomial(5, 2), BigUint::from(10u32));
assert_eq!(binomial(5, 0), BigUint::from(1u32)); // empty choice
assert_eq!(binomial(2, 5), BigUint::from(0u32)); // k > n