Permutations Calculator P(n,k)
Count ordered arrangements of k items chosen from n distinct items.
P(n,k) is the number of ways to arrange k items in order from a pool of n distinct items.
How is this calculated?
Formula: P(n, k) = n! / (n - k)!. Computed as the product n x (n-1) x (n-2) x ... x (n-k+1) using JavaScript BigInt for exact integer arithmetic. Source: standard combinatorics (Rosen, Discrete Mathematics and Its Applications).
What is the Permutations Calculator?
The Permutations Calculator computes P(n, k), the number of ordered arrangements of k items drawn from n distinct items. The formula is P(n, k) = n! divided by (n minus k)!.
Permutations differ from combinations: order matters. The arrangements {A, B} and {B, A} are counted separately. The tool above accepts n up to 1000, returns the exact integer using JavaScript BigInt, and prints both decimal and scientific notation so very large arrangement counts remain readable.
How the formula works
The product form is what the tool evaluates: start at n and multiply k descending consecutive integers. P(10, 3) is 10 times 9 times 8, ignoring the cancelled (n - k)! tail of the factorial. Source: Rosen, Discrete Mathematics and Its Applications (8th ed.), Section 6.3.
Worked example: race finish
Ten runners compete; how many distinct first, second, third place orderings are possible?
- n = 10 runners, k = 3 medal positions.
- P(10, 3) = 10 times 9 times 8 = 720.
- Cross check: C(10, 3) = 120 unordered groups of three. Multiply by 3! = 6 to recover the ordered count: 120 times 6 = 720.
- If repetition were allowed (which is impossible in a race) the count would be 10^3 = 1,000.
Reference table of common permutations
| Scenario | n | k | P(n, k) |
|---|---|---|---|
| 3 digit PIN, distinct digits | 10 | 3 | 720 |
| 3 digit PIN, repeats allowed | 10 | 3 | 1,000 (10^3) |
| License plate: 3 letters then 3 digits, all distinct | 26 | 3 | 15,600 letters * 720 digits |
| Race podium (10 runners) | 10 | 3 | 720 |
| Seat 5 people in 5 chairs | 5 | 5 | 120 (5!) |
| Anagrams of "MISSISSIPPI" | 11 | 11 | 34,650 (multinomial) |
| Travelling Salesman tours, 12 cities | 11 | 11 | 39,916,800 (fix start) |
Common pitfalls
- Mixing P and C. Permutations count ordered arrangements, combinations unordered subsets. Always ask: does swapping two items create a new outcome? Yes means use P.
- Repetition forgotten. Without repetition use P(n, k). With repetition use n^k (each of k slots is independent).
- Identical items. If some items in the pool are indistinguishable, divide n! by the factorial of each repeat count. MISSISSIPPI has 11! / (4! 4! 2! 1!) = 34,650 anagrams.
- Circular arrangements. Seating n people around a round table is (n - 1)!, not n!, because rotations are equivalent.
- Overflow. 20! already exceeds the safe integer range in JavaScript. Always use BigInt for n above about 20.
When to use permutations
- Cryptography: brute force keyspace = (alphabet size)^(key length) when repeats are allowed.
- Scheduling and routing: Travelling Salesman, job sequencing, tournament brackets.
- Probability: arranging cards, drawing without replacement, race finishing positions.
- Linguistics and bioinformatics: counting anagrams, gene orderings, DNA codon arrangements.
Related calculators and references
Frequently asked questions
What is the difference between permutations and combinations?
How is P(n, k) calculated?
What is a permutation with repetition?
What about distinguishable arrangements of n items?
Where do permutations show up in real problems?
Why does P(n, 0) equal 1?
Sources
- Rosen, Kenneth H. (2018). Discrete Mathematics and Its Applications, 8th edition, McGraw Hill, Section 6.3.
- Graham, Knuth and Patashnik (1994). Concrete Mathematics, 2nd edition, Addison Wesley, Chapter 5.
- NIST Digital Library of Mathematical Functions, 26.2 Permutations.
- Cormen, Leiserson, Rivest, Stein (2022). Introduction to Algorithms, 4th edition, Chapter on counting.
