Permutation and Combination Calculator: nPr, nCr and Lottery Odds
By FindMySum · Last reviewed
A permutation and combination calculator counts the ways to choose r items from a set of n. The answer depends on two questions: does the order of the chosen items matter, and can the same item be chosen more than once? Each pair of answers has its own formula, and the calculator works out all four exactly, however many digits the result has. This article explains when to use each, with the calculator's default example: the Canadian Lotto 6/49 draw.
The four counting formulas
| Order matters | Order doesn't matter | |
|---|---|---|
| No repetition | nPr = n! ÷ (n − r)! | nCr = n! ÷ (r! × (n − r)!) |
| Repetition allowed | nʳ | C(n + r − 1, r) |
Excel has a function for each: PERMUT, COMBIN, PERMUTATIONA and COMBINA. The calculator's results match them where Excel can hold the number, and keep going where Excel overflows.
Permutations without repetition
Lining up r of n distinct items: n choices for the first position, n − 1 for the second, down to n − r + 1 for the last. Multiplying gives n! ÷ (n − r)!. Awarding gold, silver and bronze among 8 runners gives 8 × 7 × 6 = 336 outcomes.
Combinations without repetition
When order doesn't matter, every group of r items has been counted r! times among the permutations (once for each ordering), so divide by r!. The 3 podium finishers out of 8, regardless of medal, can be chosen in 336 ÷ 6 = 56 ways. This number, written C(n, r) or "n choose r", is the binomial coefficient described in NIST's Digital Library of Mathematical Functions §26.3.
Permutations with repetition
If each position can take any of the n items again, every one of the r positions has n choices, giving nʳ. A 4-digit PIN has 10⁴ = 10,000 possibilities; a 6-character password from 26 lowercase letters has 26⁶, about 309 million.
Combinations with repetition
Choosing r items where repeats are allowed and order doesn't matter is like putting r identical balls into n labelled boxes. The "stars and bars" argument turns it into choosing r positions out of n + r − 1, so the count is C(n + r − 1, r). Three scoops of ice cream from 10 flavours, where a double chocolate is allowed, can be served in C(12, 3) = 220 ways.
Worked example: Lotto 6/49
In Lotto 6/49 six numbers are drawn from 1 to 49 without replacement, and your ticket wins the jackpot if it matches all six in any order. Order doesn't matter and numbers can't repeat, so the number of possible tickets is
C(49, 6) = 49! ÷ (6! × 43!) = (49 × 48 × 47 × 46 × 45 × 44) ÷ 720 = 13,983,816
A single ticket has a 1 in 13,983,816 chance of the jackpot, which is the figure OLG publishes. If the order of the draw mattered, there would be 49 × 48 × 47 × 46 × 45 × 44 = 10,068,347,520 sequences: 720 times more, because each set of six can be drawn in 6! = 720 orders.
Reading the chart
The calculator draws C(n, k) for every k from 0 to n, with your r highlighted. The bars rise to a peak at k = n ÷ 2 and fall symmetrically, because choosing k items to take is the same as choosing n − k to leave behind: C(49, 6) = C(49, 43). For large n the shape approaches the bell curve of the normal distribution, the reason the binomial distribution is so often approximated by a normal one in statistics.
Edge cases
- Choosing nothing. C(n, 0) = nP0 = 1: there is exactly one empty selection.
- Choosing more than there are. Without repetition, r > n is impossible and both counts are 0. Excel reports #NUM! instead; mathematically the count is simply zero. With repetition, r can exceed n freely.
- Very large numbers. C(1000, 500) has 300 digits. The calculator multiplies whole numbers of unlimited size, so the result is exact to the last digit, while a spreadsheet would show only the first 15 digits or overflow.
From counts to probabilities
When every selection is equally likely, the probability of one particular selection is 1 divided by the number of selections. That makes these counts the backbone of probability for cards, lotteries, quality-control samples and tournament brackets. For the chance of at least one success in repeated trials, or of exactly k successes, the probability calculator builds on the same binomial coefficients.
More questions
How do I decide whether a problem needs a permutation or a combination?
Swap two of the chosen items and ask whether you get a different outcome. If a committee of Ana and Ben is the same as Ben and Ana, order doesn't matter: use a combination. If Ana as chair with Ben as secretary differs from the reverse, order matters: use a permutation. Words like arrange, rank, sequence or code usually signal a permutation; group, team, hand or sample signal a combination.
How do I count arrangements of letters that repeat, such as in BANANA?
Divide the factorial of the total by the factorial of each repeated letter's count: 6! ÷ (3! × 2!) = 60 for BANANA, which has three As and two Ns. This multinomial coefficient is a different case from the four this calculator covers, which all assume the n items are distinct.
How many ways can people sit around a round table?
For n people around a circle, (n − 1)!, because rotating everyone one seat gives the same arrangement. Six people can sit in 5! = 120 distinct ways instead of 720. If a reflection counts as the same too (a necklace rather than a table), halve it again.
How are combinations related to Pascal's triangle?
Row n of Pascal's triangle lists C(n, 0), C(n, 1), …, C(n, n). Each entry is the sum of the two above it, which is the identity C(n, r) = C(n − 1, r − 1) + C(n − 1, r): a selection either includes a particular item or it doesn't. The same numbers are the coefficients when (a + b)ⁿ is expanded.
Does buying more lottery tickets change the odds a lot?
Each different ticket adds one more winning combination, so 10 tickets for Lotto 6/49 give 10 chances in 13,983,816, about 1 in 1.4 million. The odds improve in direct proportion to the number of distinct tickets, but they stay tiny; buying the same numbers twice adds nothing except a share of the prize.
Sources
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.