Permutations Calculator (nPr)
P(n, r) โ the number of ordered arrangements of r items chosen from n where order DOES matter. Falling-factorial expansion, real-life examples, and Stirling's approximation for huge inputs.
Permutations โ P(n, r)
Answer
Show your work
- FormulaP(n, r) = n! รท (nโr)! = n ร (nโ1) ร โฆ ร (nโr+1)โ order DOES matter
- Expand (r terms in the numerator)10 ร 9 ร 8= 720
Permutations Calculator โ P(n, r) with falling-factorial expansion
Enter n (pool size) and r (how many to arrange). The calculator returns the number of ordered arrangements of r items chosen from n where order matters. The show-your-work expands the falling factorial โ n ร (nโ1) ร โฆ ร (nโr+1) โ so you see r terms multiplied, not a giant n! divided by another giant (nโr)!. For huge results we show compact scientific notation with a "show full digits" expander, and surface a Stirling-derived approximation for an independent magnitude check.
For order-doesn't-matter selection, see the Combinations calculator. For raw n!, see the Factorial calculator.
Where permutations show up in the real world
Permutations appear any time there's an ordered selection โ and "ordered" can mean ranks, distinct slots, or any attribute that makes one arrangement different from a re-ordering of the same items.
Ranked outcomes
Olympic podium (gold/silver/bronze), top-3 in any race or contest, first / second / third place finishes.
Distinct roles
Assigning president / VP / secretary from a candidate pool, casting roles in a play, ordered draft picks.
PINs & passwords
PINs that don't allow repeated digits, password permutations, license plate prefixes, room number assignments.
Scheduling & ordering
Conference talk slots (slot 1 = keynote, slot 2 = follow-up), interview blocks, ordered to-do lists.
Word arrangements
Anagrams of all-distinct-letter words, ordered letter sequences, ordered route waypoints.
Algorithm analysis
Brute-force permutation search (TSP, sequence alignment, scheduling) โ gives the upper bound on the search space.
Permutation or combination? โ the test
Ask: does the order matter?
- Yes โ Permutation: race medals (gold โ silver), PIN codes, seating order, word arrangements, distinct roles.
- No โ Combination: poker hands, lottery numbers, picking a study group, pizza toppings.
Permutations are always โฅ combinations (when r โฅ 2): P(n, r) = C(n, r) ร r! โ each group of r items can be ordered in r! distinct ways.
Quick reference โ common permutations at a glance
| P(n, r) | Value | Scenario |
|---|---|---|
| P(5, 2) | 20 | 2 of 5 in order |
| P(8, 3) | 336 | Olympic podium from 8 finalists |
| P(10, 4) | 5,040 | 4-digit PIN, no repeats |
| P(26, 4) | 358,800 | 4-letter prefix, no repeats |
| P(52, 5) | 311,875,200 | Ordered 5-card draw |
| P(50, 6) | 11,441,304,000 | Ordered 6-number lottery |
| P(100, 10) | โ 6.28 ร 10ยนโน | Top-10 ranking from 100 |
Approximating P(n, r) for huge inputs
When the count exceeds 2^53 (about 9 ร 10^15), even 64-bit floats lose precision in the last few digits. Two strategies:
- log10 sum: log10 P(n, r) = ฮฃ log10(n โ i) for i = 0..rโ1. Each log10 is small, the sum is exact in float arithmetic, and the magnitude (number of digits, mantissa) follows immediately.
- Stirling on each factorial: P(n, r) โ Stirling(n!) รท Stirling((nโr)!). Each application has relative error ~1/(12k); combined the error is still tiny โ under 0.1% from n = 84 onward.
The calculator uses the log-sum form for the displayed magnitude and surfaces the Stirling approximation as an educational sanity check.
Frequently asked questions
What is a permutation?
โพ
What is a permutation?
โพA permutation is an ORDERED arrangement of r items chosen from a pool of n. P(10, 3) = 720 means there are 720 distinct ways to award gold, silver, and bronze among 10 runners โ gold-silver-bronze is different from bronze-silver-gold. Order matters.
How is a permutation different from a combination?
โพ
How is a permutation different from a combination?
โพA permutation cares about order; a combination doesn't. The same 3 students chosen from a class of 20: as a study group (combination) it's C(20, 3) = 1,140 distinct groups. As 3 distinct roles โ president / VP / secretary (permutation) โ it's P(20, 3) = 6,840 distinct assignments. Six times more, because every group of 3 can fill the roles in 3! = 6 different orders. Math relationship: P(n, r) = C(n, r) ร r!.
What is P(n, n) and why does it equal n!?
โพ
What is P(n, n) and why does it equal n!?
โพP(n, n) is the full permutation โ arranging ALL n items in order. For 5 books on a shelf, P(5, 5) = 5 ร 4 ร 3 ร 2 ร 1 = 120 = 5!. The formula confirms this: P(n, n) = n! / (n-n)! = n! / 0! = n! / 1 = n!.
What is P(n, 0)?
โพ
What is P(n, 0)?
โพP(n, 0) = 1 for any n. There is exactly one way to arrange zero items โ the empty arrangement. The formula holds: P(n, 0) = n! / n! = 1.
How does the calculator avoid huge factorials?
โพ
How does the calculator avoid huge factorials?
โพFalling-factorial form. P(n, r) = n ร (n-1) ร ... ร (n-r+1) โ only r terms in the multiplication. P(52, 3) = 52 ร 51 ร 50 = 132,600. We never compute 52! directly. The downside: the result itself can still be huge, so we display it in compact scientific notation when needed.
When do I use a permutation in real problems?
โพ
When do I use a permutation in real problems?
โพWhenever the order of selection matters: race medals (gold โ silver), assigning distinct roles, seating arrangements, PIN codes (1234 โ 4321), word/letter arrangements, scheduling order. If "first / second / third" or "different roles" appears in the problem, it's a permutation.
Permutations with repetition โ does this calculator do that?
โพ
Permutations with repetition โ does this calculator do that?
โพNot directly. This calculator is for permutations WITHOUT repetition (each item used at most once). Permutations WITH repetition (like 4-digit PINs where digits CAN repeat) is just n^r โ for example, 10^4 = 10,000 PINs if repeats are allowed. Use a basic calculator for that case.
How do I compute P(n, r) by hand?
โพ
How do I compute P(n, r) by hand?
โพMultiply r consecutive integers starting at n and going down. P(8, 3) = 8 ร 7 ร 6 = 336. P(15, 4) = 15 ร 14 ร 13 ร 12 = 32,760. Don't plug into the n! / (nโr)! formula and compute the factorials separately โ you'll just be cancelling most of it. The product form IS the cancellation.
When does P(n, r) become approximate in this calculator?
โพ
When does P(n, r) become approximate in this calculator?
โพOnce the count exceeds 2^53 โ 9 ร 10^15, JavaScript can't represent it exactly. The calculator flags it as approximate, but the magnitude (number of digits, leading digits, scientific-notation form) is reliable. Stirling's approximation in the right-hand panel gives an independent closed-form check.
What is Stirling's approximation, and why is it useful here?
โพ
What is Stirling's approximation, and why is it useful here?
โพStirling's formula gives a closed-form estimate: n! โ โ(2ฯn) ร (n/e)^n. Applied to P(n, r) = n!/(nโr)! you get an estimate that needs no big-integer arithmetic. The relative error shrinks as ~1/(12n), so it's already under 1% by n = 9 and under 0.1% by n = 84. We surface it for huge inputs so you can sanity-check the magnitude.
How big is P(52, 5) โ the ordered card-draw count?
โพ
How big is P(52, 5) โ the ordered card-draw count?
โพP(52, 5) = 52 ร 51 ร 50 ร 49 ร 48 = 311,875,200. That's the number of distinct ordered 5-card draws from a deck. Most card-game problems use the unordered count C(52, 5) = 2,598,960 (= P(52, 5) / 5!).
Where do permutations show up beyond textbooks?
โพ
Where do permutations show up beyond textbooks?
โพCryptography (key arrangements, password permutation counts), scheduling (ordered task slots), genetics (chromosome arrangements), bioinformatics (sequence alignment), routing (vehicle / TSP order), tournament brackets, lottery rankings. Any time an "order" attribute is meaningful, P(n, r) is the count.
How do I compute permutations of items WITH some repeats?
โพ
How do I compute permutations of items WITH some repeats?
โพFor a multiset with n items where one element appears nโ times, another nโ times, etc., the count is n! / (nโ! ร nโ! ร โฆ). Example: anagrams of MISSISSIPPI = 11! / (4! ร 4! ร 2!) = 34,650. This calculator handles all-distinct permutations only โ divide by the repeat factorials yourself.
Where to next?
Three counting tools + probability โ once you have the count, probability becomes easy.