Permutations and Combinations

nPr counts ordered choices of r from n; nCr counts unordered choices.

ₙPᵣ = n! ÷ (n − r)!  ₙCᵣ = n! ÷ (r!(n − r)!)

n! (factorial) is 1 × 2 × … × n, with 0! = 1.

Order does not matter for combinations, so nCr = nPr ÷ r!.

Calculator

Change a value and the result and picture update instantly.

Result

Permutations nPr20
Combinations nCr10

Animated picture

The picture follows your values. Some points and shapes can be dragged.

Use in game development

Count possible card hands or puzzle layouts to estimate probabilities and difficulty.

Code example (JavaScript)

let c = 1; for (let i = 1; i <= r; i++) c = c * (n - r + i) / i; // nCr

What the symbols mean

SymbolMeaning
nTotal n
rChosen r
PPermutations nPr
CCombinations nCr

More formulas in this category

Frequently asked questions

What is the formula for Permutations and Combinations?
The formula for Permutations and Combinations is ₙPᵣ = n! ÷ (n − r)!  ₙCᵣ = n! ÷ (r!(n − r)!). nPr counts ordered choices of r from n; nCr counts unordered choices.

Math Formula Quiz Probability & Statistics

Sources

Checked: 2026-11-29