Skip to main content

permutations

Function permutations 

Source
pub const fn permutations(n: u64, k: u64) -> Result<u128, CombinatoricsError>
Expand description

Returns the number of ordered selections of size k from n items.

§Errors

Returns CombinatoricsError::KExceedsN when k > n.

Returns CombinatoricsError::PermutationOverflow when the result no longer fits in u128.

§Examples

use use_combinatorics::permutations;

assert_eq!(permutations(5, 3)?, 60);