Permutations Calculator
Result
Permutations (order counted)
- Combinations (order ignored)
- 120
A permutations calculator answers a counting question: from a pool of n distinct items, how many ways are there to take r of them when the order counts? It reports that number, and next to it the same count with the order ignored — the combination — so the two rows differ by exactly the factor the ordering adds. That factor is the factorial of r: any set of r chosen items can be lined up in r! different orders, which is why permutations are always the larger of the two rows and why they are equal when r is 1. The distinction matters wherever positions differ from members: the first three finishers in a race is a different question from which three people finished, and a password is a permutation while a lottery draw is a combination. The page also switches the whole calculation when repeated picks are allowed, because drawing with replacement turns the count into a power rather than a falling factorial, and r is then no longer limited by the size of the pool.
Formula
P(n, r) = n! / (n − r)! = nPr C(n, r) = n! / (r! (n − r)!) P(n, r) = C(n, r) · r!
- n
- The size of the pool you are drawing from — the number of distinct items available, up to 1000. The ceiling is a bound on the arithmetic rather than on the idea: the counts grow with n, and past a point the exact value no longer fits the range of integers this page can represent exactly
- r
- How many items you take. It must not exceed n while repeats are disallowed, since you cannot take more distinct items than exist; once repeats are allowed, r may be larger and is limited only by how large a power the page can still compute exactly
- n!
- The factorial of n: n multiplied by every whole number below it down to 1. It is the count for taking everything in order, and it is the term the division by (n − r)! removes
- P(n, r)
- The number of arrangements: n choices for the first position, n − 1 for the second, and so on for r positions. The product n × (n − 1) × … × (n − r + 1) is what the formula writes as n! / (n − r)!
- C(n, r)
- The count with the order ignored, reported as the second row. It divides the arrangement count by r!, the number of ways any one chosen set can be ordered — which is the whole difference between the two rows
- allowRepetition
- Which of the two settings the page is in. When repeats are allowed the count becomes n to the power of r, because every one of the r picks has the full pool to choose from again; the order-ignored row switches to the multiset count instead
Use it when the positions are distinguishable: podium places in a race, the order of the first three cards dealt, a password, a licence plate or a seating chart, any list where swapping two entries makes a different outcome. Use the combination row — or the other page of this pair — when the outcome is a set, because then two arrangements of the same r items are the same answer and dividing by r! is exactly the correction. Turn on repetition when an item can be picked again after it is picked: a four-digit PIN has 10⁴ possibilities because each digit is drawn from the full set of ten, whereas a lottery draw of distinct balls does not. And read the second row even when you came for the first: the two counts together are the clearest statement of why order matters at all, since they differ by a single factor.
Worked examples
Ten items, three places, order counted
- Ten choices for the first place, nine left for the second, eight for the third
- Multiply: 10 × 9 × 8 = 720 arrangements
- Ignoring the order divides by 3! = 6, giving 120 sets
- 720 / 120 = 6, which is exactly 3!
The two rows are the whole point of this page in one line: the same ten items and the same three places give 720 if the order counts and 120 if it does not, and the ratio between them is 3! — the number of ways to rearrange three chosen items. Whenever a permutation and a combination look inconsistent, dividing one by the other is the check: if the ratio is not a factorial, something is wrong with the setup rather than with the arithmetic.
A podium finish out of eight runners
- Eight possible winners, seven possible runners-up, six possible third places
- 8 × 7 × 6 = 336 ways to fill the podium
- Ignoring the order, the same three people form one set however they are arranged: 336 / 6 = 56
- Reversing the multiplication instead — 8!/(8−3)! = 40320/120 — gives the same 336
This is the everyday shape of the distinction: a race result is a permutation because the silver medal is not the gold one, while a qualifying group is a combination because the three people who advance are the same three whoever ran fastest. Note how the same pair of numbers would appear on the combination page with the two rows swapped — that is the pair working as intended, not a duplication.
Dealing five cards in order
- Fifty-two choices for the first card, fifty-one for the second, and so on down to forty-eight for the fifth
- 52 × 51 × 50 × 49 × 48 = 311,875,200 ordered deals
- A hand of five cards ignores the order, so divide by 5! = 120
- 311,875,200 / 120 = 2,598,960 — the familiar number of five-card poker hands
2,598,960 is the number quoted in every poker probability, which makes this the example where a reader can check the page against something they have seen elsewhere. It is also the clearest case of the ordering factor being enormous: dealing the same five cards in a different sequence is a different ordered deal but the same hand, and the factor between the two counts is 120 rather than 6. Both counts are exact here, with no rounding.
Three-digit codes where digits may repeat
- With repeats allowed, each of the three positions is chosen from all ten digits independently
- 10 × 10 × 10 = 1000 codes
- The order-ignored row is no longer 1000 / 6, because the arrangements of a code like 777 are not all distinct
- It becomes the multiset count: C(10 + 3 − 1, 3) = C(12, 3) = 220
The interesting number here is the second row. With distinct items the order-ignored count is just the arrangement count divided by r!, but once repeats are allowed that division over-corrects — 777 has only one distinct arrangement, not six — so the page switches to a different formula rather than dividing. 220 is the count of three-digit multisets of ten digits, and it is the reason the repetition switch changes both rows rather than only the first.
Limitations
Two boundaries are enforced rather than explained away, and both are worth knowing before the numbers surprise you. While repeats are disallowed, r cannot exceed n: taking four items from a pool of three distinct ones is not an unlikely outcome but an impossible request, and the page says so instead of returning zero. The pool size is capped at 1000. The second limit is the one that actually bites in practice: the arrangement count is a product that grows extremely fast, and this page reports exact whole numbers rather than an approximation in scientific notation. Past the point where the true value stops being representable exactly, it declines to answer rather than printing an integer whose last digits are wrong — a plausible-looking wrong number is far worse here than a clear refusal, because the wrong number would be copied into whatever depends on it. There is also a smaller arithmetic limit on the repetition branch, where the count is a power and very large exponents overflow the same way. Two further points about meaning. Neither row here is a probability — both are counts of equally likely arrangements, and turning a count into a chance means dividing by the total number of possibilities, which depends on the process rather than on the pair of numbers on this page. And there is no reference table of factorials, binomial coefficients or Pascal's triangle here, for the reason the fifth question below gives.
Frequently asked questions
- What is the difference between a permutation and a combination?
- A permutation counts arrangements and a combination counts sets: swap two of the chosen items and a permutation has produced a different outcome while a combination has not. The page reports both so the relationship is visible rather than asserted — the arrangement count is always the larger of the two, and dividing it by the factorial of r gives the other row. In practice the question to ask is whether the positions carry meaning. If the third slot is different from the second, as in a race result or a card dealt in sequence, you want the arrangement count; if the three chosen items are interchangeable, you want the set count.
- Why do the two rows differ by exactly r factorial?
- Because every set of r chosen items can be lined up in r! different sequences, and the arrangement count treats each of those sequences as a separate outcome. Taking r = 3, any three items can be ordered six ways, so one set corresponds to six arrangements and the arrangement count is six times the set count. This is also the fastest way to sanity-check a calculation: divide the two rows and the answer should be a factorial. If it is not, the mismatch is in the setup rather than in the arithmetic — most often a pool size or a repeat setting that does not match the situation being described.
- When does picking the same item twice count as different?
- Exactly when the situation allows it to be picked twice at all — that is the switch the repetition setting controls, and it changes both rows rather than only the first. A four-digit PIN draws each digit afresh from all ten, so 0000 and any other repeat are ordinary outcomes and the count is 10⁴; a lottery draw takes balls out of the drum, so no number can appear twice and the count is a falling product instead. With repeats allowed the set count is no longer the arrangement count divided by r!, because a pick like 777 has one distinct arrangement rather than six, and the page uses the multiset count for that row.
- Why does the page refuse to take more items than the pool holds?
- While repeats are disallowed, r greater than n describes a procedure that cannot be carried out: the fourth distinct item does not exist when only three are available. The page reports the problem instead of returning zero, because zero is a legitimate count in other settings and would be read as an answer. Turn repetition on and the same request becomes perfectly ordinary — three items taken five at a time with repeats allowed is 3⁵ = 243 arrangements — which is why the limit lives on the combination of the two settings rather than on r alone.
- Why is there no Pascal's triangle or factorial table on this pair of pages?
- Because a table here could not see the two numbers you entered, and the table people want — factorials, binomial coefficients, the rows of Pascal's triangle — is a list for fixed small values. Put one on the page and it would answer a different question from the panel above it, sometimes visibly disagreeing with the row you are looking at, which is worse than no table at all. The panel is the table: change n, r or the repetition setting and both rows recompute. This pair of pages reaches the same verdict as the other counting tools rather than one page offering a table and the other not, since the two are two directions of the same question.
- Why does the answer stop working for large pools?
- Because the arrangement count is a product of long runs of whole numbers, and it passes the largest integer this page can represent exactly far sooner than most people expect — the factorial of 19 is already beyond it, even though its 18 digits do not look alarming. Past that point the page declines to answer rather than printing a number whose last several digits are wrong, and the digits are the whole value of an exact count: a wrong integer looks completely ordinary and would be copied into whatever calculation depends on it. The pool ceiling of 1000 is a separate, looser guard on the same concern — it stops the input at a size where the arithmetic is still worth attempting.
References
- Permutation — from Wolfram MathWorld (a rearrangement of the elements of an ordered list, and the count of them for a set of a given size) — Wolfram MathWorld
- Combination — from Wolfram MathWorld (the number of ways of picking unordered outcomes from a set, also called the binomial coefficient and read "n choose k") — Wolfram MathWorld
- 1.3.6.1. What is a Probability Distribution — e-Handbook of Statistical Methods (the frequency reading of probability, which is how a count of equally likely arrangements becomes a chance) — National Institute of Standards and Technology (NIST)