The Permutation and Combination Calculator answers the two counting questions that students and analysts constantly confuse: in how many orders can I arrange r items chosen from n (permutations), and in how many ways can I simply choose them (combinations). Enter the total number of items n and how many are selected r; both results come back together so the contrast is visible.
How It Works
Permutations count arrangements: choosing a president, a vice president, and a treasurer from ten people is ordered, because the same three people in different roles are different outcomes. Combinations count selections: choosing a three-person committee from the same ten people ignores roles, so each group is counted once. The combination count is always the permutation count divided by r!, the number of ways to arrange the chosen group internally.
Parameters
| Input | Required | Meaning | |---|---|---| | n | Yes | Total distinct items to choose from (0 to 170) | | r | Yes | Items selected; cannot exceed n |
Worked example
For n = 10 and r = 3: permutations are 10! / 7! = 10 x 9 x 8 = 720, and combinations are 10! / (3! x 7!) = 720 / 6 = 120. Ordered podium finishes from ten runners: 720. Unordered three-person committees from ten people: 120. The factor of six between them is 3!, exactly the number of ways to rank any chosen trio. A second useful anchor: choosing all items (r = n) gives exactly 1 combination but n! permutations, which is why a combination lock is badly named, since its code is an ordered permutation.
Which one does your problem need?
Ask one question: if I swap two of the selected items' positions, do I get a different outcome? Passwords, rankings, seating orders, race finishes, and schedules: different, so permutations. Committees, lottery tickets, hands of cards, and ingredient selections: not different, so combinations. Mixed problems compose both: pick a committee of 5 from 12 (combinations), then choose its chair from within (multiply by 5), a standard two-stage count. Probability problems then divide the favourable count by the total count computed the same way, and most student errors trace back to mixing the two modes between numerator and denominator.
Limits and overflow
Factorials grow violently: 170! is about 7.3 x 10^306, close to the largest finite double-precision number, which is why n is capped at 170. The calculator also requires whole numbers with r no larger than n, and it models selection without repetition and without replacement: problems where items repeat (drawing with replacement, arranging letters of a word with repeated letters) need adjusted formulas, for permutations with repetition the count is n^r, and for arrangements of multiset letters it is the total factorial divided by each repeat count's factorial.
Limitations
The tool computes the two textbook counts for distinct items, no repetition, no constraints. It does not handle circular arrangements, derangements, problems with mandatory inclusions or exclusions (handle those by reducing n and r before entering), or probability directly, though probability is one division away once both counts exist.
The lottery reality check
Combinations explain lottery odds exactly. A 6-from-49 lottery has 49! / (6! x 43!) = 13,983,816 possible combinations, so a single ticket's jackpot chance is 1 in about 14 million, and buying two tickets doubles it to 2 in 14 million rather than changing its nature. The same math prices smaller games instantly: 5 from 35 gives 324,632 combinations. Running your game's n and r through this calculator replaces vague "someone has to win" reasoning with the actual denominator, which is the beginning of every sensible decision about playing.
Frequently Asked Questions
Why is the combination count always smaller?
Because every unordered group of r items corresponds to exactly r! ordered arrangements. Combinations collapse those into one, so the counts differ by that factor whenever r is above 1.
What does r = 0 return?
Both counts are 1: there is exactly one way to choose nothing and one way to arrange nothing. That is a definition, and it is what makes formulas like the binomial theorem work at the edges.
How do I count passwords or PINs?
Those allow repetition and order matters, so the count is n^r (for a 4-digit PIN, 10^4 = 10,000), not nPr. Use the permutation result only when each item can be used at most once.