CalcCombination

CalcCombination

CalcCombination[ n, k ] returns the number of ways to choose k items from a set of n items.

Usages

CalcCombination[ n, k ]

CalcCombination[ n, k ] returns (nk)\binom{n}{k}, the number of ways to choose k items from a set of n items, where the order does not matter. n and k must be non-negative integers with k ≤ n.

Example in out
Choose 2 items out of 5. CalcCombination[ 5, 2 ] 10
Choose 5 cards out of 52. CalcCombination[ 52, 5 ] 2598960
There is one way to choose nothing. CalcCombination[ 6, 0 ] 1
There is one way to choose everything. CalcCombination[ 6, 6 ] 1
Script variables. n := 10
k := 3
r := CalcCombination[n, k]
r = 120
Details
  • Large numbers: the smaller of k and n-k may be at most 100. CalcCombination[ 300, 250 ] is calculated, because 300-250 = 50, but CalcCombination[ 300, 150 ] is left unevaluated.
  • Lists are not supported: CalcCombination[ {5,6}, 2 ] is left unevaluated. Use Map to apply it to each element.
Invalid input Result
CalcCombination[ 6, 7 ] Left unevaluated: k is larger than n.
CalcCombination[ -6, 2 ] Left unevaluated: n and k must not be negative.

See also: Factorial, Map