Permutation and Combination Calculator
Count arrangements and selections with nPr, nCr, and repetition variants.
Inputs
nPr — Permutations (no repetition)
720
Ordered arrangements of r items chosen from n, without replacement.
nCr — Combinations (no repetition)
120
Unordered selections of r items chosen from n, without replacement.
Permutations (with repetition)
1,000
nʳ ordered arrangements when items may repeat.
Combinations (with repetition)
220
C(n+r−1, r) unordered selections when items may repeat.
n!
3628800
r!
6
(n−r)!
5040
Step by step
nPr (order matters, no repetition)
P(10,3) = 10! / (10−3)! = 3628800 / 5040
= 720
nCr (order does not matter, no repetition)
C(10,3) = 10! / (3! × (10−3)!) = 720 / 6
= 120
Permutations with repetition (order matters)
n^r = 10^3
= 1,000
Combinations with repetition (order doesn't matter)
C(n+r−1, r) = C(12, 3)
= 220
How it works
Permutations count ordered arrangements. If you choose r items from n in a specific order, the number of ways is nPr = n!/(n−r)!. Combinations count unordered selections; the order of the chosen items doesn't matter: nCr = n!/(r!(n−r)!). When repetition is allowed — the same item can be chosen more than once — permutations become nʳ and combinations become C(n+r−1, r).
Formulas
Permutation (no repetition)
nPr = n! / (n−r)!
- n
- Total items
- r
- Items chosen
Combination (no repetition)
nCr = n! / (r! × (n−r)!)
Permutation (with repetition)
Permutations with repetition = nʳ
Combination (with repetition)
Combinations with repetition = C(n+r−1, r)
Frequently Asked Questions
What is the difference between a permutation and a combination?
Order matters in permutations, not in combinations. Choosing the three people {Alice, Bob, Carol} for a committee is one combination but six permutations (ABC, ACB, BAC, BCA, CAB, CBA). Use permutations when sequence matters (race finishing positions, PIN codes); use combinations when it doesn't (lottery draws, team selection).
When do I use the repetition variants?
Use permutations with repetition (nʳ) when items can be reused: e.g., counting 4-digit PINs from digits 0–9 = 10⁴ = 10,000. Use combinations with repetition (C(n+r−1,r)) for unordered selections where repeats are allowed: e.g., choosing 3 ice cream scoops from 5 flavours when you can repeat flavours.
Why is n limited to 170?
171! overflows JavaScript's float64 to Infinity. For n ≤ 170 the factorial stays representable. If you need exact arithmetic for larger n you would need a big-integer library, which this platform does not include.
How is nCr computed without overflow?
The implementation uses k = min(r, n−r) and divides as it multiplies, keeping intermediate values small. This makes C(60, 30) = 118,264,581,564,861,424 computable exactly in float64, well beyond what a naive factorial ratio would handle.