Combination Calculator
- 120
- Combinations nCr: order ignored
- 720
- Permutations nPr: order matters
- 220
- Combinations with repetition
- 1,000
- Permutations with repetition
The combination calculator shows all four counts at once: combinations and permutations, each with and without repetition. Seeing them together is the point, the only thing separating nCr from nPr is whether order matters, and having both on screen makes choosing the right one straightforward.
How it works
- Combinations nCr, order ignored. Choosing 3 people from 10 for a committee: 120 ways.
- Permutations nPr. Order matters. Choosing 3 from 10 for gold, silver and bronze: 720 ways.
- Combinations with repetition, choosing 3 scoops from 10 flavours, repeats allowed: 220 ways.
- Permutations with repetition, a 3-digit code from 10 digits: 1,000 ways. Simply n to the power of r.
nPr = nCr x r!
- r!
- the number of orderings of the r chosen items, which is exactly what combinations ignore and permutations count
The calculation uses a multiplicative loop rather than computing factorials. 171! overflows to infinity in JavaScript, so anything relying on n! / (r!(n−r)!) fails well before the answer itself would.
Examples
Committee versus podium
n
10
r
3
Result
nCr 120 · nPr 720 · With repetition 220 · Ordered with repetition 1,000
720 is 120 × 3!, because each committee of three can be arranged on a podium in six ways.
A lottery draw
n
49
r
6
Result
nCr 13,983,816
The odds of matching all six in a 6-from-49 draw. Order does not matter on a lottery ticket, which is why this is the combination and not the permutation of 10 billion.
r larger than n
n
5
r
8
Result
nCr 0 · nPr 0 · With repetition 495
You cannot choose 8 distinct items from 5, so both counts without repetition are zero. With repetition allowed the question still makes sense.
Frequently asked questions
How do I know whether I need a combination or a permutation?
Ask whether reordering the chosen items produces a different outcome. A committee of Alice, Bob and Carol is the same committee in any order, so that is a combination. Gold, silver and bronze changes meaning when reordered, so that is a permutation.
Why not just compute the factorials?
Because 171! exceeds the largest number JavaScript can represent and becomes infinity, so the standard formula fails for inputs whose answers are perfectly representable. Multiplying and dividing term by term keeps the intermediate values small. NCr(1000, 3) works fine here.
What does "with repetition" mean?
That items can be chosen more than once. Three scoops from ten flavours allows all three the same, giving 220 combinations rather than 120. A three-digit PIN allows repeated digits, giving 1,000 rather than 720.
Why does the calculator warn above n = 1,000?
Because the results exceed 2^53, beyond which JavaScript integers are no longer exact. The figures remain approximately right but the final digits stop being trustworthy.