Permutation calculator (nPr) with step-by-step working
Count the ways to arrange r items chosen from n when the order matters. The calculator gives exact values of nPr with the working shown, and covers the other three permutation questions that come up most: repetition allowed, words with repeated letters, and seating around a circle.
On this page
The permutation formula
A permutation is an ordered arrangement. The number of ways to arrange items chosen from distinct items, without repeats, is
The right-hand form shows where it comes from. There are choices for the first position. Whatever you picked, items are left for the second, then , and so on until all positions are filled. The product rule multiplies these together. When , every item is placed and the count is , because .
Worked example: gold, silver and bronze among 8 runners
- Order matters (gold then silver is not silver then gold) and no runner can win two medals, so use .
- Formula: .
- Cancel : keep the top three factors, .
- Multiply: 336 possible podiums.
Four kinds of arrangement
The calculator has a mode for each of these. Picking the right one is most of the work.
1. No repetition: nPr
Distinct items, each used at most once. Five people standing in a line: = 120. Electing a president, a secretary and a treasurer from a club of 20: = 6840. Compare that with choosing an unranked committee of three, which is a combination: = 1140. The ratio is exactly , the number of ways to hand out three different roles to the same three people.
2. Repetition allowed: n to the power r
When an item can be used again, every position has all choices: . A four-digit PIN has = 10,000 possibilities. A number plate with three letters followed by four digits: = 175,760,000. Strictly speaking these are sequences or “words” rather than permutations, but calculators and exam papers usually list them under permutations with repetition.
3. Repeated identical items: anagrams
How many different words can be made from the letters of MISSISSIPPI? If all 11 letters were different there would be orders. But swapping two of the S’s gives the same word. The four I’s can be permuted among themselves in ways, the four S’s in , and the two P’s in , without changing anything. So divide those out:
In general, for items in groups of identical items of sizes , the number of distinct arrangements is the multinomial coefficient
BANANA has one B, three A’s and two N’s, so it has = 60 arrangements; the calculator lists all of them. MISSISSIPPI has 34,650. Type comma-separated items instead of a word to count arrangements of anything else, such as red, red, blue, green.
4. Around a circle
Six people at a round table. In a row there are orders, but moving everyone one seat to the left gives the same seating, since each person has the same neighbours. Each circular seating appears 6 times among the row orders, once per rotation, so there are = 120. In general people fit around a circle in ways, and choosing of to seat gives .
Clockwise and anticlockwise versions still count as different here: the people on your left and right swap. For a necklace or key ring that can be turned over, they are the same, so halve the answer (for ).
Arrangements with conditions
Many exam questions add a rule. Two techniques handle most of them.
Glue items together. How many ways can 3 maths, 4 physics, 2 chemistry and 3 biology books stand on a shelf if each subject stays together? Treat each subject as one block: orders of the blocks. Then arrange the books inside each block: . The product is 1728.
Subtract the arrangements you don’t want. How many ways can 5 people stand in a line if Ana and Ben must not be next to each other? All orders: . Orders with them together: glue them into one block, orders, times 2 for the order inside the block, giving 48. So .
How large factorials get
Factorials grow faster than any exponential. is about 3.6 million, already exceeds , and the number of ways to shuffle a 52-card deck is ≈ , a 68-digit number. Ordinary calculators switch to rounded scientific notation long before that. This one uses exact BigInt arithmetic in your browser and prints every digit, with the scientific form alongside once a value reaches ten digits.
The growth matters in computer science: a brute-force search that tries every ordering of items, such as the naive solution to the travelling-salesperson problem, does work and becomes hopeless around . The same count gives the lower bound for comparison sorting, explained on the sorting algorithms page: a sort must tell all input orders apart.
References
- K. H. Rosen, Discrete Mathematics and Its Applications, 8th ed., McGraw-Hill, 2019. Sections 6.3 (permutations) and 6.5 (permutations with indistinguishable objects).
- R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics, 2nd ed., Addison-Wesley, 1994. Sections 4.4 and 5.1.
- “Permutation”, Wikipedia.