This permutation and combination calculator counts the ways to choose r items from a set of n. It returns permutations (nPr), where order matters, and combinations (nCr), where it does not, plus both “with repetition” variants. Results are exact integers up to 21 digits; larger answers are shown in scientific notation with the total digit count, computed exactly for n up to 1,000.
Permutation vs. combination
Ask one question: does the order of the chosen items change the outcome? Gold, silver and bronze medals for 3 of 10 runners are a permutation: Ana–Ben–Cy differs from Cy–Ben–Ana. Picking 3 of 10 people for a committee is a combination, because the same three people form the same committee in any order. Each combination of 3 can be arranged in 3! = 6 orders, which is why there are 6 times as many permutations.
Formulas
nPr = n! ÷ (n − r)! nCr = n! ÷ (r! × (n − r)!) = nPr ÷ r! with repetition, order matters: nʳ with repetition, order ignored: C(n + r − 1, r) = (n + r − 1)! ÷ (r! × (n − 1)!)
Here n! (n factorial) is n × (n − 1) × … × 2 × 1, with 0! = 1. “With repetition” means each item can be chosen more than once, like digits in a PIN or scoops of the same ice cream flavor.
Worked examples
- Podium finishes, n = 10, r = 3: 10P3 = 10 × 9 × 8 = 720; 10C3 = 720 ÷ 6 = 120. With repetition, 10³ = 1,000 ordered sequences (like a 3-digit lock code) and C(12, 3) = 220 unordered multisets.
- Poker hands, n = 52, r = 5: C(52, 5) = 2,598,960 five-card hands. Dealt in order there are 311,875,200 sequences, exactly 5! = 120 times as many.
- Lottery, 6 of 49: C(49, 6) = 13,983,816, so one ticket has a 1 in 13,983,816 chance of the jackpot. The probability calculator turns counts like this into percentages.
- Large values: C(100, 50) = 100,891,344,545,564,193,334,812,497,256, a 30-digit number, displayed as ≈ 1.008913445 × 10²⁹.
- r larger than n: you cannot choose 5 distinct items from 3, so 3P5 = 3C5 = 0, but with repetition there are 3⁵ = 243 sequences and C(7, 5) = 21 multisets.
Which formula fits your problem?
| Situation | Order matters? | Repeats allowed? | Formula | Example |
|---|---|---|---|---|
| Race finishes, seating, passwords without repeated characters | Yes | No | nPr | 8 runners, top 3: 336 |
| Teams, committees, card hands, lottery tickets | No | No | nCr | 5 toppings of 12: 792 |
| PIN codes, license plates, dice sequences | Yes | Yes | nʳ | 4-digit PIN: 10,000 |
| Donut boxes, coin piles, scoops of flavors | No | Yes | C(n + r − 1, r) | 6 donuts from 4 kinds: 84 |
Pascal’s triangle and symmetry
Combinations are the entries of Pascal’s triangle: row n lists C(n, 0) through C(n, n). Two identities help with mental checks. First, C(n, r) = C(n, n − r), because choosing 3 people to include is the same as choosing 7 to leave out: 10C3 = 10C7 = 120. Second, C(n, r) = C(n − 1, r − 1) + C(n − 1, r), which builds each row from the one above. The largest value in each row sits in the middle, at r = n ÷ 2.
Factorial reference
Most textbook problems use small factorials, so it pays to recognize them. Note how fast they grow: each step multiplies by the next integer.
| n | n! | n | n! |
|---|---|---|---|
| 0 | 1 | 6 | 720 |
| 1 | 1 | 7 | 5,040 |
| 2 | 2 | 8 | 40,320 |
| 3 | 6 | 9 | 362,880 |
| 4 | 24 | 10 | 3,628,800 |
| 5 | 120 | 12 | 479,001,600 |
A full permutation of all n items is n!, so 10 books can be shelved in 3,628,800 orders. Set r = n in the calculator to get it.
How the calculator stays exact
Factorials grow explosively: 20! already exceeds 2.4 quintillion, and 171! overflows ordinary floating-point numbers. Instead of computing n! and dividing, the calculator multiplies only the needed factors (n down to n − r + 1) and divides step by step for combinations, using exact big-integer arithmetic. Every digit is correct, even for C(1,000, 500), a 300-digit number. Results longer than 21 digits are rounded to 10 significant figures for display only.
Common mistakes
- Using permutations for unordered groups. If swapping two chosen items gives the same result, use nCr.
- Forgetting repetition. A 4-digit PIN allows 0000 and 1122, so it is 10⁴ = 10,000, not 10P4 = 5,040.
- Dividing by the wrong factorial. nCr divides by r! and (n − r)!; nPr divides only by (n − r)!.
Related calculators
- Probability Calculator
- Dice Roller
- Random Number Generator
- Exponent Calculator
- Scientific Notation Calculator
Frequently Asked Questions
What is the difference between nPr and nCr?
nPr counts ordered arrangements and nCr counts unordered groups. nPr is always r! times larger than nCr, for example 720 versus 120 for n = 10, r = 3.
How many combinations does a 4-digit code have?
If digits can repeat and order matters, it is 10⁴ = 10,000. Despite the name “combination lock”, this is a permutation with repetition.
What is 0! and why does nC0 equal 1?
0! is defined as 1, so nC0 = n! ÷ (0! × n!) = 1. There is exactly one way to choose nothing.
Can r be larger than n?
Only when repetition is allowed. Without repetition you cannot choose more distinct items than exist, so nPr and nCr are 0; with repetition the counts are nʳ and C(n + r − 1, r).
How many 5-card poker hands are there?
C(52, 5) = 2,598,960. Of these, 4 are royal flushes, giving odds of 1 in 649,740.