Permutations (nPr) Calculator
Solve the classic permutation relation nPr = n! / (n − r)! for any of its three unknowns — the number of ordered arrangements, the size of the pool, or the number of positions filled — with step-by-step working, a live counting schematic, and companion combination metrics.
Order matters — that is the whole point
A permutation counts sequences, not sets. Choosing the letters A, B, C in that order is a different outcome from C, B, A. That is why nPr is always larger than the corresponding combination nCr — by exactly a factor of r!, the number of ways to reorder the r chosen items. Whenever a problem mentions positions, ranks, passwords, race finishes, batting orders, or schedules, you almost certainly want a permutation rather than a combination.
Growth is brutally fast
Each extra position multiplies the count by the next available item. Going from r to r + 1 multiplies nPr by (n − r). This is why a 4-digit PIN has 5,040 possibilities but a 6-digit PIN has 151,200, and why 20! already exceeds 2.4 quintillion — more than the number of grains of sand on Earth. Factorial growth is the reason brute-force search collapses so quickly as keys get longer.
Without replacement is the default assumption
The formula n! / (n − r)! assumes each item can be used at most once. When repetition is allowed the count becomes nr instead, which is always larger. A 4-digit PIN with repeats allowed has 10,000 codes; without repeats it has only 5,040. Getting this distinction wrong is the single most common error in counting problems, so always ask first whether an item can be reused.
It underpins probability and algorithms
Permutations are the backbone of probability (the chance of any one ordered outcome is 1 / nPr), of sorting analysis (n! possible orderings of n items sets the lower bound for comparison sorts), and of scheduling and routing. The travelling-salesman problem, job-shop scheduling, and tournament bracket generation are all, at heart, questions about permutations — and their difficulty comes directly from how fast nPr explodes.
How to Use This Calculator
The permutation relation links three quantities: nPr, n, and r. Pick which one you want the tool to solve, then fill in the other two.
1. Choose what to solve for
Pick nPr, n, or r from the toggle. The calculator rearranges nPr = n! / (n − r)! for whichever variable you choose — including the inverse searches for n and r.
2. Use realistic presets
Presets cover common cases: permutation counts from 6 to 3,628,800, pool sizes from 5 to 52 items, and selection sizes from 2 to 10 positions.
3. Remember the two hard rules
Both n and r must be whole numbers, and r can never exceed n. If r = n you are arranging the entire pool and nPr = n!. If r = 0 there is exactly one arrangement (the empty one) for any n.
4. Read the result and verdict
The result card shows the count, plus a colour-coded badge that classifies the magnitude from a handful of arrangements up to astronomically large counts that need scientific notation.
5. Check the schematic and charts
The schematic shows a pool of n items feeding r ordered slots and producing the final count. The chart plots nPr against r on a log scale for three different pool sizes.
6. Switch to Advanced for depth
Advanced mode adds a second chart of nPr against n, a sensitivity check on +1 to n and +1 to r, and companion metrics including combinations nCr, factorials, and the probability of a single arrangement.
What This Tool Offers
Built around the classic permutation relation nPr = n! / (n − r)!, the fundamental count of ordered selections without replacement.
Three-way solving
Solve for the permutation count, the pool size n, or the selection size r. The inverse searches for n and r use monotonic binary search with an exactness check.
Clean counting schematic
A pool-to-slots-to-outcomes diagram that redraws itself as you change n and r, so you can see exactly what is being counted.
Magnitude verdict
Each result is classified from a handful of arrangements, through the thousands and millions, up to counts so large they need scientific notation.
Big-number safe
Exact BigInt arithmetic is used wherever the result fits, with a smooth fallback to log-scale scientific notation for counts with hundreds of digits.
Dual comparison charts
nPr vs. r for three pool sizes, plus an advanced nPr vs. n chart for three selection sizes, both on log axes.
Reference tables
A full permutation lookup grid, a permutations-versus-combinations comparison, and a variable reference table with the standard notation.
Reference Tables & Lookups
A permutation lookup grid and a direct comparison with combinations.
Permutation lookup — nPr
| n \ r | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
|---|
Permutations vs. Combinations
Both count selections of r items from n, but permutations care about order and combinations do not. The two are linked by nPr = nCr × r!.
| n, r | nPr (ordered) | nCr (unordered) | Ratio nPr / nCr = r! | Classic example |
|---|
Typical Permutation Problems
Representative counting questions and the value of nPr that answers them.
| Problem | n | r | nPr | Notes |
|---|---|---|---|---|
| Podium finishes in a 10-runner race | 10 | 3 | 720 | Gold, silver, bronze — order matters |
| 4-digit PIN, no repeated digits | 10 | 4 | 5,040 | 10,000 codes if repeats allowed |
| Arrange all 6 books on a shelf | 6 | 6 | 720 | nPr = n! when r = n |
| Two-card draw from a 52-card deck | 52 | 2 | 2,652 | Ordered hands; 1,326 unordered |
| 5-letter words from 26 letters, no repeats | 26 | 5 | 7,893,600 | Repeats allowed would give 11,881,376 |
| Batting order for 9 players | 9 | 9 | 362,880 | 9! — every player used once |
| Seat 8 guests in 8 numbered chairs | 8 | 8 | 40,320 | 8! seating arrangements |
| Pick a 3-person committee with roles | 20 | 3 | 6,840 | Chair, secretary, treasurer |
Variable Reference
| Symbol | Meaning | Typical range | Units |
|---|---|---|---|
| nPr | Number of ordered arrangements | 1 – 10300+ | count (dimensionless) |
| n | Size of the pool | 0 – 105 | items (whole number) |
| r | Number of positions filled | 0 – n | slots (whole number) |
| nCr | Combinations — same selection, order ignored | 1 – 10300+ | count (dimensionless) |
| n! | Factorial of n | 1 – 10300+ | count (dimensionless) |
| r! | Number of orderings of r items | 1 – 10300+ | count (dimensionless) |
What Does nPr = n! / (n − r)! Measure?
A permutation is an ordered selection. If you have n distinct items and you fill r distinct positions with them, without ever using the same item twice, the number of possible outcomes is nPr. The formula divides n! — the number of ways to line up all n items — by (n − r)! — the number of ways to line up the items you did not choose, which are irrelevant because they never appear.
The word "ordered" is doing all the work here. If the positions were indistinguishable — a committee rather than a podium, a hand of cards rather than a sequence of draws — the answer would be the combination nCr, which is exactly r! times smaller.
Permutation Formula
The defining relationship is:
Because the (n − r)! cancels, the same value can be written as a falling product of r terms:
Rearranged to solve for the other two unknowns:
r = the number of factors needed to reach nPr from n
When r = n the denominator becomes 0! = 1 and nPn = n!, the number of ways to arrange the entire pool.
Permutation Variables
| Symbol | Meaning | Notes |
|---|---|---|
| n | Total items in the pool | Whole number ≥ 0; must be ≥ r |
| r | Items selected and ordered | Whole number with 0 ≤ r ≤ n |
| nPr | Number of ordered arrangements | Also written P(n, r) or A(n, r) |
| nCr | Number of unordered selections | Equals nPr / r! |
| nr | Ordered arrangements with repetition | Always ≥ nPr |
How Each Variable Affects the Count
Adding one more item to the pool does not simply add a fixed number of outcomes — it multiplies the count. Going from n to n + 1 while holding r fixed multiplies nPr by (n + 1) / (n + 1 − r). For a large pool and a small r this is close to a factor of 1 + r/n; for a small pool and a large r it can be dramatic.
Increasing r has an even sharper effect, because each extra position adds another multiplicative factor of roughly (n − r). This is the mathematical reason passwords get disproportionately safer as they get longer, why exhaustive search over orderings is hopeless beyond about 15 items, and why the lower bound on comparison sorting is n log n rather than n! — we cannot afford to enumerate the permutations, only to reason about them.
Permutation Calculation Examples
10P4 = 10! / 6! = 10 × 9 × 8 × 7 = 5,040
n(n−1)(n−2)(n−3) = 5,040 → n = 10
10 × 9 × 8 × 7 = 5,040 after four factors → r = 4
6P6 = 6! / 0! = 720 = 6!
52P5 = 52 × 51 × 50 × 49 × 48 = 311,875,200
Frequently Asked Questions
Both count ways of selecting r items from a pool of n, but nPr treats different orders as different outcomes and nCr does not. If you are filling a podium, a password, a batting order, or any set of labelled positions, you want nPr. If you are forming a committee, a hand of cards, or any group where the members are interchangeable, you want nCr. The two are related by nPr = nCr × r!, so the permutation count is always the larger of the two, larger by exactly the number of ways the chosen items can be reordered among themselves. For 10 items choosing 4, nPr = 5,040 while nCr = 210, and the ratio is 4! = 24.
Whenever repetition is allowed. The permutation formula n! / (n − r)! assumes that once an item is used it is removed from the pool — dealing cards, seating people, assigning distinct labels. If an item may be reused, each of the r positions has all n choices independently, giving nr outcomes. A 4-digit PIN allows repeated digits, so there are 104 = 10,000 codes; if repeats were forbidden there would be only 10P4 = 5,040. Always check whether the problem says "without replacement" — if it does not, think carefully about which model fits the real-world situation.
Because there is exactly one way to arrange nothing: do nothing. This is not just a convention — it is forced by consistency. The recurrence n! = n × (n − 1)! requires 1! = 1 × 0!, and since 1! = 1 we need 0! = 1. It also makes the permutation formula behave correctly at the edges: nPn = n! / 0! = n!, and nP0 = n! / n! = 1, both of which match intuition. Without 0! = 1, arranging an entire pool or choosing nothing at all would both break.
No. If you have only 5 items you cannot fill 7 distinct positions without reusing an item, and the permutation formula explicitly assumes no reuse. Mathematically, (n − r)! would require a factorial of a negative number, which is undefined in the ordinary sense (it involves the gamma function and poles). This calculator validates the constraint and will flag an error if you enter r > n. If you genuinely need to fill more positions than you have items, you are looking at permutations with repetition, and the answer is nr rather than nPr.
Enormous. 20! is about 2.43 × 1018, 52! — the number of ways to shuffle a deck of cards — is about 8.07 × 1067, and 100! has 158 digits. Double-precision floating point runs out around 170!, and even the exact integer arithmetic used here falls back to log-scale scientific notation once the count passes a few hundred digits. This calculator computes exactly with arbitrary-precision integers whenever the result fits within a reasonable size, and switches smoothly to scientific notation beyond that, so you always get a meaningful answer rather than an overflow.
Both nPr as a function of n (with r fixed) and as a function of r (with n fixed) are strictly increasing, so the calculator uses binary search. For a given target count, it narrows the range of candidate values using a log-scale comparison, then checks the few candidates nearest the boundary for an exact match. If the target does not correspond to any whole-number solution — for example asking for 1,000 permutations with r = 3, which falls between n = 10 and n = 11 — the tool reports the closest values and warns that no exact solution exists.
Anywhere order matters. Password and PIN strength analysis, lottery and card-game probability, race and tournament result counting, scheduling and rostering, routing and the travelling-salesman problem, genetics (gene ordering), cryptography (permutation ciphers and key spaces), and computer science generally — the n! orderings of n items set the lower bound for comparison sorting, and permutation enumeration underlies backtracking algorithms. Even the "how many ways can I arrange my playlist" question is a permutation problem, and the answer is almost always larger than people expect.
Variables
| Symbol | Quantity | Unit |
|---|---|---|
| nPr | Number of permutations | |
| n | Total number of distinct items | |
| r | Number of items being arranged |
What it means
The number of permutations (ordered arrangements) of r objects selected from a set of n distinct objects is nPr = n!/(n−r)!. This counts the number of sequences, where order matters. It is used in problems involving passwords, race results, seating arrangements, and in algorithm analysis (e.g., number of possible states). In probability, permutations are used to calculate the number of favourable outcomes. Understanding permutations is foundational for combinatorics and discrete mathematics, with applications in computer science, cryptography, and operations research.
Worked example
Permutations – Two Examples
Real‑World| Parameter | Value |
|---|---|
| n | 5 |
| r | 3 |
| Parameter | Value |
|---|---|
| n | 8 |
| r | 3 |
Common mistakes
- Permutations: nPr = n!/(n−r)! – order matters.
- If r > n: The result is 0 (or undefined).
- n!: Factorial of n – ensure n is a non‑negative integer.
- Applications: Used in counting arrangements, seating, and sequences.
- Check: For small numbers, verify manually.
Applications
Permutations, nPr = n!/(n−r)!, give the number of ordered arrangements of r items from a set of n. This is fundamental in combinatorics and probability. Engineers use it in scheduling, resource assignment, and cryptography. In operations research, it helps in sequencing and routing problems. In computer science, it appears in algorithm analysis and graph problems. By calculating permutations, professionals can quantify the number of possible orders, which is essential for optimisation, risk assessment, and decision‑making in diverse fields such as logistics, software testing, and game theory.
- Task scheduling and assignment problems
- Cryptography – key space and password strength
- Production sequencing and route planning
- Probability calculations in games and betting
- Combinatorial optimisation and search algorithms
Related calculators · Probability Distributions
Recently updated formulas
Suggest an improvement
Found a mistake? Have a better example? Let us know.
You may send up to 3 suggestions per 24 hours.