Skip to main content

comb_rep

Function comb_rep 

Source
pub fn comb_rep<N: PrimInt + Unsigned>(n: N, k: N) -> N
Expand description

$k$-combinations of $n$ things with replacement

Because this (also) counts the number of multisets of size $k$ drawn from an $n$-element set, it is also known as the multiset coefficient, and sometimes expressed as “$n$ multichoose $k$”.

It is equivalent to comb(n + k - 1, k).

Pure rust implementation of scipy.special.comb(n, k, exact=True, repetition=True).

§Types

  • N: Any unsigned integer

§See also

  • comb: $k$-combinations of $n$ without replacement
  • perm: $k$-permutations of $n$, $_nP_k$
  • binom: the binomial coefficient as a floating point function