Function permutations

Compute the number of ways of obtaining an ordered subset of k elements from a set of n elements.

Permutations only takes integer arguments. The following condition must be enforced: k <= n.

Syntax

permutations(n)
permutations(n, k)

Parameters

Parameter Type Description
n number | BigNumber The number of objects in total
k number | BigNumber The number of objects in the subset

Returns

Type Description
number | BigNumber The number of permutations

Examples

permutations(5);     // 120
permutations(5, 3);  // 60

See also

combinations, factorial