Skip to main content

perm

Function perm 

Source
pub fn perm<N: NumOps + ConstOne + Copy>(n: N, k: u32) -> N
Expand description

$k$-permutations of $n$ things, $_nP_k$

Permutations of $n$ things taken $k$ at a time, also known as “partial permutations”. It can be written in terms of the falling factorial, but unlike xsf::pow_falling, this function computes the result exactly for integer types.

Corresponds to scipy.special.perm(n, k, exact=True).

§Types

  • N: Any numeric type supporting basic arithmetic operations

§Returns

The number of $k$-permutations of $n$, i.e. $n(n-1)(n-2) \cdots (n-k+1)$

§See also

  • comb: $k$-combinations of $n$ things, $_nC_k$
  • factorial: factorial $n!$, the special case $k = n$
  • pow_falling: falling factorial power function