nPr — Ordered Arrangements of r Items from n
Last reviewed: April 2026
A permutation calculator determines the number of ways to arrange items from a set when the order matters. It computes P(n, k) = n! / (n-k)!, which is used in probability, scheduling, and any problem where sequence is important.
A permutation counts how many ways you can arrange r items selected from n total items when the order of arrangement matters. The formula is P(n,r) = n! / (n−r)!. For example, the number of ways to award gold, silver, and bronze medals to 10 athletes is P(10,3) = 720, because the same 3 athletes in different positions count as different permutations. Compare this to the 120 combinations C(10,3) — permutations are always larger because each combination generates r! arrangements. For combination calculations, use our Combination Calculator.
Standard permutations (without repetition) assume each item can only be used once — like choosing a PIN where each digit is different. With repetition allowed, each position can use any item, giving n^r total permutations. A 4-digit PIN with digits 0–9: without repetition gives P(10,4) = 5,040; with repetition gives 10^4 = 10,000. Passwords typically allow repetition, which is why longer passwords are exponentially harder to crack.
Permutations appear in ranking systems, tournament brackets, password security, license plate combinations (with repetition), seating arrangements, and scheduling. Understanding the difference between permutations and combinations is fundamental to probability and statistics. See our Statistics Calculator for statistical analysis tools.
| n | r | P(n,r) | Meaning |
|---|---|---|---|
| 5 | 3 | 60 | Arrange 3 from 5 |
| 10 | 4 | 5,040 | Arrange 4 from 10 |
| 26 | 3 | 15,600 | 3-letter codes from alphabet |
| 52 | 5 | 311,875,200 | 5-card sequence from deck |
A permutation is an ordered arrangement of elements — the sequence matters. Arranging 3 books on a shelf from a collection of 10 is a permutation problem because the order of the books on the shelf is distinct (ABC is different from BAC). The formula P(n,r) = n!/(n−r)! counts the number of possible arrangements of r items selected from n total items. With 10 books choosing 3 positions: P(10,3) = 10!/(10−3)! = 10 × 9 × 8 = 720 possible arrangements. The factorial function (n! = n × (n−1) × (n−2) × ... × 1) grows extraordinarily fast: 10! = 3,628,800 and 20! exceeds 2.4 quintillion, which is why even modestly sized permutation problems produce enormous counts that make exhaustive enumeration impractical without mathematical formulas or algorithms.
| Concept | Order Matters? | Formula | Example: 5 choose 3 |
|---|---|---|---|
| Permutation | Yes | P(n,r) = n!/(n−r)! | 60 arrangements |
| Combination | No | C(n,r) = n!/(r!(n−r)!) | 10 groups |
The key distinction: if swapping two selected items creates a different outcome (like positions in a race, digits in a code, or letters in a word), use permutations. If swapping does not matter (like selecting committee members, choosing lottery numbers, or picking pizza toppings), use combinations. Permutations always produce equal or larger counts than combinations for the same n and r because each combination corresponds to r! different permutations. The relationship P(n,r) = C(n,r) × r! makes the conversion straightforward. Use this calculator for ordered arrangements and our related tools for combination problems.
When elements can be reused, the formula simplifies to n^r — n choices for each of the r positions, independently. A 4-digit PIN using digits 0–9 with repetition allowed has 10⁴ = 10,000 possibilities. Without repetition, the count drops to P(10,4) = 10 × 9 × 8 × 7 = 5,040 — roughly half. Password security calculations use permutations with repetition: an 8-character password using 26 lowercase letters, 26 uppercase letters, 10 digits, and 10 special characters (72 possible characters) has 72⁸ ≈ 722 trillion possibilities. Adding just one more character multiplies this by 72, demonstrating why longer passwords provide exponentially better security. Each additional character position multiplies the total permutation count by the full alphabet size, making brute-force attacks proportionally more difficult.
When some elements are identical, the number of distinguishable permutations is reduced because swapping identical elements does not create a visibly different arrangement. The formula becomes n!/(n₁! × n₂! × ... × nk!) where n₁, n₂, etc. are the counts of each identical group. The word MISSISSIPPI has 11 letters with 4 S's, 4 I's, 2 P's, and 1 M: the number of distinguishable arrangements is 11!/(4! × 4! × 2! × 1!) = 39,916,800/1,152 = 34,650. Without accounting for identical letters, the count would be 11! = 39,916,800 — nearly 1,000 times larger. This adjustment appears in probability calculations, statistical mechanics (distributing identical particles among energy states), and combinatorial optimization problems where some options are interchangeable.
When elements are arranged in a circle rather than a line, rotations of the same arrangement are considered identical — rotating everyone one seat to the right at a round table does not create a new seating arrangement. The number of circular permutations of n distinct elements is (n−1)!. Seating 8 people around a circular table has 7! = 5,040 distinct arrangements, compared to 8! = 40,320 linear arrangements. If the circular arrangement has an additional symmetry — like a bracelet or necklace where flipping also produces the same arrangement — the count halves to (n−1)!/2. Circular permutations appear in chemistry (cyclic molecular structures), scheduling (rotating tournament formats), and cryptography (circular shift operations). The underlying principle is that fixing one element's position removes the rotational symmetry, converting the circular problem into a linear permutation of the remaining n−1 elements.
A derangement is a permutation where no element remains in its original position — every item moves. The number of derangements of n elements, denoted D(n) or !n, equals n! × Σ(−1)^k/k! for k from 0 to n. For n = 4: D(4) = 24 × (1 − 1 + 1/2 − 1/6 + 1/24) = 24 × 3/8 = 9. This means if 4 people each put a gift into a pile and randomly draw one, there are exactly 9 arrangements where nobody receives their own gift — out of 24 total possible arrangements. The probability of a derangement approaches 1/e ≈ 36.8% as n increases, regardless of the number of elements. Derangements appear in probability theory (the hat-check problem), cryptography (fixed-point-free permutations in cipher design), and genetics (chromosomal crossover arrangements where no gene remains in its original position).
Permutation problems scale factorially — the fastest-growing common complexity class in computer science. With 10 elements, there are 3.6 million permutations; with 15 elements, over 1.3 trillion; with 20 elements, more than 2.4 quintillion. This explosive growth means that algorithms which enumerate all permutations become impractical beyond about 12–15 elements on modern hardware. The traveling salesman problem — finding the shortest route through n cities — requires evaluating (n−1)!/2 permutations for an exact solution, making it NP-hard. For n = 25, this exceeds 10²³ routes — more than the estimated number of stars in the observable universe. Practical solutions use heuristic and approximation algorithms (greedy nearest-neighbor, simulated annealing, genetic algorithms) that find near-optimal solutions in polynomial time without guaranteeing the absolute best permutation. Quantum computing offers potential speedup for certain permutation problems through Grover's algorithm, which can search unsorted databases (and by extension permutation spaces) in √n operations rather than n — though practical quantum computers capable of addressing real-world permutation optimization remain years away from commercial viability. Understanding the factorial growth of permutation spaces is essential for recognizing when exact solutions are computationally tractable and when approximate methods must be employed — a distinction that separates effective algorithm design from naive brute-force approaches that waste computing resources on intractable enumeration. Understanding when a problem requires exact permutation enumeration versus heuristic approximation is a fundamental skill in algorithm design and operations research.
Permutation calculations arise across disciplines. In cryptography, key space sizes (the number of possible encryption keys) are permutation counts that determine resistance to brute-force attacks. In tournament scheduling, round-robin formats require permutations of team pairings across rounds. In genetics, DNA codon sequences are permutations of four nucleotide bases — the 64 possible three-base codons (4³ permutations with repetition) encode 20 amino acids plus stop signals. In music, twelve-tone composition techniques permute all 12 chromatic notes into tone rows. In logistics, route optimization (the traveling salesman problem) seeks the minimum-cost permutation of city visits — with n cities, there are (n−1)!/2 possible routes, making exact solutions computationally infeasible for more than about 20 cities and requiring heuristic algorithms for practical-sized problems. Use our Prime Factorization tool for related number theory computations.
→ Run multiple scenarios. Try different inputs to understand how each variable affects the result. This builds practical intuition beyond just getting a single answer.
→ Use accurate inputs for reliable results. The output is only as good as the input. Use measured values rather than rough estimates whenever possible.
→ Bookmark for quick access. Save this page for instant reference — no need to search for it again the next time you need this calculation.
→ Explore related tools. Check the related calculators section below for tools that complement this one — many calculations work best in combination.
See also: Combination Calculator · Statistics Calculator · Prime Factorization · Logarithm Calculator · Equation Solver