A four-digit phone PIN and a lottery draw of four numbers from fifty feel like the same counting problem, but they are not. In the PIN, the order of the digits is everything; in the lottery, only the set of numbers matters. Confusing the two can make your count wrong by a factor of twenty-four. This tool handles both situations: permutations, where order counts, and combinations, where it does not.
Two formulas, one idea
Both formulas count the ways to choose r items from n items. The permutation version keeps every ordering as a separate outcome, while the combination version treats reorderings of the same items as one outcome.
Formula: nPr = n! / (n - r)! for permutations; nCr = n! / (r! x (n - r)!) for combinations
In plain words: n! counts all possible orderings of all n items, and the divisions strip away the orderings you do not want to count separately. The extra r! in the combination formula is what collapses the different orderings of the chosen items into a single selection. So nPr is always the bigger number, and the gap between the two grows fast as r grows.
How to use it
- Decide whether order matters in your problem. Phone PINs, passwords, and race finishes are permutations. Lottery draws, teams, and committees are combinations.
- Enter n, the total number of items to choose from.
- Enter r, how many items you are choosing.
- Read the result, and double-check you picked the right mode.
If you need factorials on their own for hand calculations, the factorial calculator is right there, and the factor calculator can help when a counting problem comes down to breaking numbers apart.
Worked example
Five runners are competing, and you want two things: how many ways the top three can finish (order matters), and how many ways to pick any three runners for a relay team (order does not matter). For the permutation: 5P3 = 5! / (5 - 3)! = 120 / 2! = 120 / 2 = 60 possible podium orders. For the combination: 5C3 = 5! / (3! x (5 - 3)!) = 120 / (6 x 2) = 120 / 12 = 10 possible teams. Notice 60 / 10 = 6, which is 3!, the number of ways to order any three chosen runners. That cross-check confirms both answers at once.
Where these counts matter
Lottery odds, card game probabilities, and team selections are combinations. Password strength estimates, seating arrangements, and anything involving ranks or schedules are permutations. In probability work, the combination count often becomes the denominator: the number of possible lottery tickets, for instance. Pair this with the combination calculator when you only need the order-free version and want the direct route to it.
Common mistakes
- Using permutations for a lottery. A 6/49 lottery is about choosing 6 numbers from 49, so it is a combination. The permutation answer would be 720 times too large.
- Allowing repeats by accident. These formulas assume each item is chosen once. A PIN code allows repeated digits, which is a different calculation: n^r.
- Swapping n and r. Choosing 3 from 5 is not the same as choosing 5 from 3, which is impossible. Keep the pool (n) bigger than the pick (r).
Limits to keep in mind
The formulas assume every item is distinct and each is picked at most once. If some items are identical, like repeated letters in a word, the count needs adjusting. Very large values of n also produce enormous results, which the tool reports in standard form rather than as a wall of digits.