Permutation Calculator | nPr
Calculate the number of permutations where order matters.
Quick examples
What Is the Permutation Calculator | nPr?
This permutation and combination calculator computes P(n,r) and C(n,r) using exact BigInt arithmetic for n up to 200, no floating-point overflow. It also shows circular permutations, n! total arrangements, and a full table of P(n,k) and C(n,k) for k = 0 to r.
- ›P(n,r) permutations: Ordered arrangements, the order of selection matters (passwords, race finishes).
- ›C(n,r) combinations: Unordered selections, order doesn't matter (lottery tickets, committee selection).
- ›Circular permutations: Arrangements around a circle, where rotations are considered identical.
- ›BigInt precision: Exact integer results for n up to 200, avoiding JavaScript floating-point limits.
- ›Comparison table: P(n,k) and C(n,k) for all k from 0 to r, with the target row highlighted.
Formula
| Formula | Definition | Example (n=5, r=2) |
|---|---|---|
| P(n,r) | Ordered selections (order matters) | P(5,2) = 5!/3! = 20 |
| C(n,r) | Unordered selections (order doesn't matter) | C(5,2) = 5!/(2!3!) = 10 |
| Circular P | (n−1)! arrangements around a circle | (5−1)! = 24 |
| n! | All arrangements of n distinct items | 5! = 120 |
How to Use
- 1Enter n (the total number of items), maximum 200.
- 2Enter r (the number of items being chosen or arranged).
- 3Press Enter or click Calculate.
- 4Read P(n,r), C(n,r), circular permutations, and n!.
- 5The comparison table shows all values from k=0 to r.
- 6Click Clear to reset.
Example Calculation
How many ways to arrange 3 books from a shelf of 10?
P vs C: the key distinction
Understanding Permutation | nPr
Permutations vs Combinations
The central question in combinatorics is: does order matter? If yes, count permutations P(n,r) = n!/(n−r)!. If no, count combinations C(n,r) = n!/(r!(n−r)!). The ratio P/C = r!, each combination generates exactly r! permutations by rearranging the selected items.
- ›Passwords (order matters): 10 digits choose 4 = P(10,4) = 5,040
- ›Lottery (order doesn't matter): 49 numbers choose 6 = C(49,6) = 13,983,816
- ›Race podium (ordered): 8 runners choose top 3 = P(8,3) = 336
- ›Committee (unordered): 20 people choose 5 = C(20,5) = 15,504
Circular Permutations
When arranging n objects in a circle, rotations of the same arrangement are considered identical. Fixing one object eliminates the rotational equivalence, giving (n−1)! distinct arrangements. For n = 6 people at a round table: (6−1)! = 120 seatings. If reflections are also considered identical (a necklace), divide by 2: (n−1)!/2.
BigInt and Large Factorials
JavaScript's regular numbers (IEEE 754 double) can represent integers exactly only up to 2⁵³ ≈ 9×10¹⁵. P(20,15) = 20!/5! = 1,860,480,000, fine. But P(50,20) ≈ 3.7×10³², far beyond double precision. This calculator uses JavaScript BigInt for exact integer arithmetic, so results for n up to 200 are always exact, not approximations.
Frequently Asked Questions
What is the difference between a permutation and a combination?
A permutation is an ordered arrangement, choosing A then B is a different outcome from choosing B then A. A combination is an unordered selection, the group {A,B} and the group {B,A} are the same combination. The fundamental test: does the order of selection affect the outcome? If yes, count permutations P(n,r); if no, count combinations C(n,r).
- ›Passwords and PINs, order matters, "1234" ≠ "4321" → use permutations P(n,r)
- ›Lottery tickets, order doesn't matter, {1,7,23} is the same ticket however drawn → use combinations C(n,r)
- ›Race podium (1st, 2nd, 3rd), ordered positions → P(8,3) = 336 for 8 runners
- ›Committee of 5 from 20, unordered group → C(20,5) = 15,504
- ›Card hand in poker, unordered 5 cards from 52 → C(52,5) = 2,598,960
The relationship is always P(n,r) = r! × C(n,r). Each combination generates exactly r! permutations by rearranging the chosen items in all possible orders. For r = 1, P = C, a single item can only be arranged one way.
What is P(n,r) and how is it calculated?
P(n,r) counts the number of ways to arrange r items chosen from n distinct items where the order of selection matters. The formula is P(n,r) = n! / (n−r)!, which simplifies to the product n × (n−1) × (n−2) × ··· × (n−r+1), exactly r consecutive integers multiplied together starting from n. Each step reflects one fewer choice as each position is filled.
- ›P(n,1) = n, trivially, n ways to pick one item
- ›P(n,n) = n!, all arrangements of n distinct items
- ›P(n,r) = 0 when r > n, cannot choose more items than exist
- ›P grows much faster than C: P(10,4) = 5040 vs C(10,4) = 210 (ratio = 4! = 24)
What is C(n,r) and how is it calculated?
C(n,r), also written nCr, ⁿCᵣ, or "n choose r", counts the number of unordered selections of r items from n distinct items. The formula is C(n,r) = n! / (r! × (n−r)!). The r! in the denominator removes all possible orderings of the same group, converting the ordered permutation count into an unordered combination count. C(n,r) also appears as a coefficient in the binomial expansion (a+b)ⁿ.
- ›C(n,0) = C(n,n) = 1, only one way to choose nothing or everything
- ›C(n,1) = n, choosing one item from n
- ›C(n,r) = C(n,n−r), choosing r is the same count as leaving out r (symmetry)
- ›C(52,5) = 2,598,960, total distinct 5-card poker hands from a 52-card deck
What are circular permutations?
When arranging n distinct objects around a circle, rotations of the same arrangement are considered identical, rotating everyone one seat to the right gives the same seating configuration. By fixing one object in place (eliminating the rotational equivalence), the remaining n−1 objects can be arranged in (n−1)! distinct ways. This is always equal to n!/n, the linear arrangements divided by the number of rotations.
- ›3 people: (3−1)! = 2 distinct seatings
- ›6 people at a dinner table: (6−1)! = 120 distinct seatings
- ›Necklace (flipping is also identical): (n−1)!/2, divide again by 2 for reflection symmetry
- ›5 beads on a bracelet: (5−1)!/2 = 12 distinct arrangements
What is the relationship between P(n,r) and C(n,r)?
P(n,r) = C(n,r) × r!, every unordered combination of r items generates exactly r! ordered permutations when the chosen items are rearranged in all possible sequences. Conversely, C(n,r) = P(n,r) / r!, dividing all ordered arrangements by the number of ways to reorder each group collapses them into unique unordered sets. This identity is foundational to the binomial theorem, Pascal's triangle, and probability theory.
- ›P ≥ C always; equal only when r = 0 or r = 1
- ›The ratio P/C = r! grows factorially, for r = 5, each combination yields 120 permutations
- ›Choosing a 5-person committee from 20: C(20,5) = 15,504 vs P(20,5) = 1,860,480 ordered selections
Why use BigInt instead of regular JavaScript numbers?
JavaScript's standard numbers are IEEE 754 64-bit doubles. They represent integers exactly only up to 2⁵³ ≈ 9 × 10¹⁵. Factorials grow much faster: 21! ≈ 5.1 × 10¹⁹ already exceeds this limit. A regular-number computation of 21! would silently round to the nearest representable double, losing the last few digits with no error or warning, giving a plausible-looking but wrong result. BigInt uses arbitrary-precision integer arithmetic, storing numbers exactly with no upper bound, at the cost of slightly slower arithmetic.
- ›20! = 2,432,902,008,176,640,000, fits in a 64-bit integer but NOT in a 53-bit double mantissa
- ›21! = 51,090,942,171,709,440,000, silent precision loss with regular Number
- ›P(200,100) has approximately 170 digits, completely impossible without BigInt
- ›C(200,100) ≈ 9 × 10⁵⁸, BigInt computes it exactly, Number gives garbage
What is the multinomial coefficient?
The multinomial coefficient generalises C(n,r) to partitioning n objects into more than 2 groups simultaneously: n! / (k₁! × k₂! × ··· × kₘ!) where k₁ + k₂ + ··· + kₘ = n. It counts the number of distinct ways to divide n distinct objects into m ordered groups of specified sizes k₁, k₂, ..., kₘ. The binomial coefficient C(n,r) is the special case with m = 2 groups of sizes r and n−r.
- ›Arrangements of "MISSISSIPPI" (11 letters: 1 M, 4 I, 4 S, 2 P): 11!/(1!×4!×4!×2!) = 34,650
- ›Distributing 12 tasks equally among 3 teams of 4: 12!/(4!×4!×4!) = 34,650
- ›Multinomial theorem: coefficients in (x+y+z)ⁿ expansion come from n!/(k₁!k₂!k₃!)
- ›Card deal: 52 cards dealt 13 each to 4 players: 52!/(13!)⁴ ≈ 5.36×10²⁸ distributions