Home / Math / Permutation and Combination Calculator
Permutation and Combination Calculator (nPr and nCr)
Count ordered arrangements (permutations) and unordered selections (combinations) of r items from n, with or without repetition. Results are exact whole numbers, however large, and all four counts are shown together.
Permutations versus combinations
Both count ways to pick r items from n. The difference is whether order matters. If you are awarding gold, silver and bronze to three of ten runners, the order matters, so you count permutations. If you are choosing a committee of three from ten people, the order does not matter, so you count combinations. Each committee corresponds to 3! = 6 different podium orders, which is why nPr = nCr × r!.
| Type | Formula | Example (n=10, r=3) |
|---|---|---|
| Permutation nPr | n! ÷ (n−r)! | 720 |
| Combination nCr | n! ÷ (r!(n−r)!) | 120 |
| Permutation with repetition | nr | 1,000 |
| Combination with repetition | (n+r−1)! ÷ (r!(n−1)!) | 220 |
When repetition is allowed
Without repetition, each item can be used once, like dealing cards. With repetition, an item can be chosen again, like digits in a PIN. A four-digit PIN is a permutation with repetition of 10 digits taken 4 at a time, giving 104 = 10,000 possibilities. Choosing three scoops of ice cream from five flavours where flavours may repeat and order is irrelevant is a combination with repetition, giving C(7, 3) = 35. The with-repetition combination count uses the "stars and bars" argument, which turns the problem into choosing positions for dividers.
Exact results for large numbers
Factorials grow extremely fast: 20! already exceeds 2 × 1018, which is beyond the safe range of ordinary floating-point numbers. This calculator uses arbitrary-precision integers, and combinations are built up one factor at a time with exact division, so there is no rounding at any step. Short results appear in full with thousands separators. Results longer than 24 digits appear as a leading value, a power of ten and the digit count, such as the 30-digit value of 100C50. The input limit of 1,000 keeps the page responsive.
Common mistakes
- Counting order when it does not matter. A lottery ticket is a combination, because the numbers drawn are not ordered.
- Forgetting that r cannot exceed n. Without repetition you cannot choose five distinct items from three. The calculator reports this rather than returning zero silently.
- Treating nCr as symmetric by accident. It is symmetric in a useful way:
nCr = nC(n−r), so choosing 3 to include is the same count as choosing 7 to leave out from 10. - Ignoring identical items. Arrangements of the letters in a word with repeated letters need a different formula: divide n! by the factorial of each repeat count.
Worked example
How many different five-card poker hands can be dealt from a standard 52-card deck?
Inputs
| Headline result | Combinations nCr (order does not matter) |
|---|---|
| Total items n | 52 |
| Items chosen r | 5 |
Result
For n = 52 and r = 5, using n! ÷ (r! × (n − r)!).
| Permutations nPr | 311,875,200 |
|---|---|
| Combinations nCr | 2,598,960 |
| Permutations with repetition | 380,204,032 |
| Combinations with repetition | 3,819,816 |
| Ordered-to-unordered ratio | nPr = nCr × r! (r! = 120) |
Accuracy note: Results use standard double-precision arithmetic, so very large or very small values may be rounded. Check important results by another method.
Frequently asked questions
What is the difference between nPr and nCr?
nPr counts selections where order matters, while nCr counts selections where it does not. Every combination can be arranged in r factorial orders, so nPr equals nCr times r factorial.
How many ways can you choose 5 cards from 52?
There are 2,598,960 different five-card hands, calculated as 52 choose 5. This ignores the order in which the cards are dealt.
What does 0 factorial equal?
Zero factorial is defined as 1. This keeps formulas such as nC0 and nCn equal to 1, because there is exactly one way to choose nothing and one way to choose everything.
When do I use permutations with repetition?
Use n to the power r when each of r positions can independently take any of n values, as with PIN codes, passwords of a fixed length or dice rolls in sequence.
Is a lottery a permutation or a combination?
It is a combination, because only which numbers are drawn matters, not the order in which the balls come out. A pick-six game from 49 numbers has 13,983,816 combinations.
Related calculators
References and sources
- Standard combinatorics: permutations, combinations and the stars-and-bars method, as presented in discrete mathematics textbooks.