🎲 Permutations (nPr) & Combinations (nCr) Calculator
nPr and nCr with and without repetition — all four cases, in exact arbitrary precision, where most calculators cover two and break on large numbers.
If repetition is allowed
8! has 5 digits. Factorials grow faster than almost anything else in elementary mathematics, which is why these counts explode so quickly.
What Permutations (nPr) & Combinations (nCr) Calculator Does
Everything in this area turns on two questions: does order matter, and can items repeat? Answer both and the formula is determined. Order matters and no repeats — that is a permutation. Order does not matter and no repeats — a combination. Allow repeats and each of those has a second form, which is where most calculators stop.
The distinction is easier with an example than a definition. Picking a captain and a goalkeeper from eleven players gives 110 outcomes, because choosing A then B is a different result from B then A. Picking two strikers from the same eleven gives 55, because the pair is the same pair whichever order you name them in. Combinations are always permutations with the redundant orderings divided out.
Repetition changes things more than people expect. A four-digit PIN has 10,000 possibilities, not 5,040, because digits can repeat — it is 10⁴ rather than 10P4. This is also why a combination lock is misnamed: the order you dial matters, so it is really a permutation lock, and one that permits repeated digits at that.
One practical note about these numbers. Factorials grow faster than almost anything else in elementary mathematics, and calculators built on ordinary floating-point arithmetic stop being exact at 20!. Past that they quietly round, and not far beyond they return Infinity. Everything here is computed in arbitrary precision, so a figure with sixty digits is correct in all sixty.
How to Use Permutations (nPr) & Combinations (nCr) Calculator
- Enter total number of elements n and sample subset size r (where r ≤ n)
- Review calculated combinations nCr and permutations nPr totals
- Inspect mathematical step-by-step factorial formulas
Formula Used by Permutations (nPr) & Combinations (nCr) Calculator
Permutations without repetition — order matters, no reuse
nPr = n! ÷ (n − r)!
- n
- Total number of distinct items available
- r
- How many you are arranging
Worked example
Choosing a captain and a goalkeeper from 11 players
- 11 choices for captain
- Once chosen, that person is unavailable, leaving 10 for keeper
- 11 × 10 = 110, which is 11! ÷ 9!
Result: 110 arrangements
Combinations without repetition — order irrelevant
nCr = n! ÷ [r! × (n − r)!]
- r!
- The number of orderings of the chosen items, divided out because they are all the same selection
Worked example
Choosing 2 strikers from the same 11 players
- Start from the 110 ordered arrangements
- A-then-B and B-then-A are the same pair, so each selection was counted 2! = 2 times
- 110 ÷ 2
Result: 55 selections
With repetition — the two cases most calculators omit
permutations = nʳ · combinations = (n + r − 1)C r
- nʳ
- Each of the r positions independently has all n options available
- (n+r−1)C r
- The "stars and bars" result — distributing r identical picks across n categories
Worked example
A 4-digit PIN from the digits 0–9
- Order matters and digits may repeat
- 10 options for each of 4 positions
- 10 × 10 × 10 × 10
Result: 10,000 — against 5,040 if no digit could be reused
All four cases, decided by two questions
Choosing r items from n. Which formula applies depends only on whether order matters and whether items may repeat.
| Order matters | Order does not matter | |
|---|---|---|
| No repetition | nPr = n! ÷ (n−r)! | nCr = n! ÷ [r!(n−r)!] |
| Repetition allowed | nʳ | (n+r−1)C r |
| Example, n=6 r=2 | 30 · 36 with repetition | 15 · 21 with repetition |
| Typical use | PINs, race places, rankings | Committees, card hands, lottery |
Worked values
Including the cases that come up most often.
| Problem | Formula | Answer |
|---|---|---|
| Arrangements of 1,2,3,4,5,6 | 6! | 720 |
| Choose 2 from 5 | 5C2 | 10 |
| 5C3 | 5! ÷ [3!·2!] | 10 — identical to 5C2 |
| Captain and keeper from 11 | 11P2 | 110 |
| Two strikers from 11 | 11C2 | 55 |
| 4-digit PIN, digits may repeat | 10⁴ | 10,000 |
| 4 digits, no repeats | 10P4 | 5,040 |
Where floating-point calculators break
Exact values computed in arbitrary precision, against what a calculator using ordinary numbers returns.
| Problem | Exact answer | Floating-point result |
|---|---|---|
| 20C10 | 184,756 | 184,756 — still fine |
| 50C25 | 126,410,606,437,752 | Correct, but 50! itself is already inexact |
| 100C50 | 100891344545564193334812497256 | 1.0089134454556415e+29 — digits lost |
| 200C100 | 90548514656103281165404177077484163874504589675413336841320 | NaN |
| 200P100 | A 217-digit integer | Infinity |
How to Read Your Result
The two questions, in order
Ask whether order matters first. If rearranging the same items gives a genuinely different outcome — a different password, a different podium — you want permutations. If it gives the same outcome — the same committee, the same hand of cards — you want combinations. Then ask whether an item can be picked twice. Drawing lottery balls without replacement cannot repeat; rolling dice or choosing PIN digits can. Those two answers pick the formula with no further judgement.
Why nCr is symmetric
5C3 and 5C2 are both 10, and that is not a coincidence. Choosing three items to take is the same act as choosing two to leave behind, so nCr always equals nC(n−r). This is worth knowing practically as well as conceptually: computing 100C97 as 100C3 involves three multiplications instead of ninety-seven, which is exactly the shortcut the calculation here uses.
Stars and bars
The formula for combinations with repetition, (n+r−1)C r, looks arbitrary until you see the argument behind it. Picture choosing 3 scoops from 5 flavors as laying out 3 stars and 4 dividers in a row: the dividers separate the flavors, and where the stars fall decides how many scoops of each. Every arrangement of stars and bars is one valid selection, and counting those arrangements gives the formula directly.
How fast these numbers grow
10! is about 3.6 million. 20! is roughly 2.4 quintillion. 100! has 158 digits and 170! is the largest factorial an ordinary double-precision number can hold at all — 171! overflows to infinity. This is why brute-force search over permutations becomes impossible so abruptly: an eight-item problem has 40,320 orderings, but a twenty-item problem has more orderings than there are grains of sand on Earth.
The lottery, honestly
A draw of 6 numbers from 49 without repetition and without regard to order is 49C6, just under 14 million. Buying a second ticket doubles your chance from one in fourteen million to two, which is a 100% improvement and still essentially zero. Combinatorics is very good at showing why intuition about large sample spaces is unreliable.
Limitations & Accuracy Notes
- Inputs are capped at n and r of 2,000. The arithmetic is exact but the numbers become impractically long well before that — 2000! has over 5,700 digits.
- Without repetition, r cannot exceed n; you cannot choose more distinct items than exist. With repetition it can, and the tool reports the with-repetition figures in that case while marking the others as undefined.
- These formulas assume every item is distinguishable. Counting arrangements of a word with repeated letters is a different calculation — multiset permutations divide by the factorial of each repeat count.
- Combinations with repetition assume the items themselves are interchangeable within a category. Three scoops of vanilla is one outcome, not three.
- Counting how many outcomes exist says nothing about whether they are equally likely. Probability needs the count and the distribution; this tool provides only the count.
Frequently Asked Questions
What is the difference between a permutation and a combination?
What are the formulas?
How many 4-digit PIN codes are there?
What is 5C3?
Why do other calculators fail on large numbers?
How much larger is a permutation than the matching combination?
Which one is a lottery?
Is a "combination lock" really a combination?
Why does zero factorial equal one?
What is the difference between with and without replacement?
Is my data stored?
References & Further Reading
- NIST Digital Library of Mathematical Functions — Combinatorial analysis — US National Institute of Standards and Technology reference for permutations, combinations and binomial coefficients
- Calculator.net — Permutation and Combination Calculator — The most thorough competing derivation; its worked values (11P2 = 110, 11C2 = 55) were used to cross-check the arithmetic here