Factorial, Permutation & Combination Calculator
Free factorial, permutation, and combination calculator. Compute n!, P(n,r), and C(n,r) with big-number support. No signup.
Factorials, permutations, and combinations
This calculator handles the three counting operations of combinatorics. A factorial n! counts the ways to arrange all n items; a permutation P(n, r) counts ordered arrangements of r items chosen from n; and a combination C(n, r) counts unordered selections of r items from n. With n = 10 and r = 3 the results are 3,628,800, 720, and 120 respectively.
How each operation is computed
- Factorial: n! = n × (n−1) × … × 1, with 0! defined as 1.
- Permutation: P(n, r) = n! ÷ (n−r)!.
- Combination: C(n, r) = n! ÷ (r! × (n−r)!).
Because factorials grow past what ordinary floating-point arithmetic can hold, the tool works in natural logarithms: it sums the logs of the integers, subtracts them for the permutations and combinations, then exponentiates. Results of 1015 or more are shown in scientific notation with a three-decimal coefficient, and the input caps n at 170 because 171! overflows the largest representable double.
Worked example with the default values
The form loads n = 10 and r = 3 in factorial mode.
| Operation | Working | Result |
|---|---|---|
| 10! | 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 | 3,628,800 |
| P(10, 3) | 10 × 9 × 8 | 720 |
| C(10, 3) | 720 ÷ (3 × 2 × 1) = 720 ÷ 6 | 120 |
The permutation result is just the first three factors of the factorial, because dividing 10! by 7! cancels everything from 7 downward. The combination then removes the ordering within each chosen triple, and there are 3! = 6 orderings of any three items, so 720 ÷ 6 = 120.
Reference: factorials and counting results
| n | n! | P(n, 3) | C(n, 3) |
|---|---|---|---|
| 0 | 1 | — | — |
| 1 | 1 | — | — |
| 2 | 2 | — | — |
| 3 | 6 | 6 | 1 |
| 4 | 24 | 24 | 4 |
| 5 | 120 | 60 | 10 |
| 6 | 720 | 120 | 20 |
| 7 | 5,040 | 210 | 35 |
| 8 | 40,320 | 336 | 56 |
| 9 | 362,880 | 504 | 84 |
| 10 | 3,628,800 | 720 | 120 |
For scale, 20! is about 2.433 × 1018, and 170! is about 7.257 × 10306, which is why large answers are printed in scientific notation.
Common mistakes
- Choosing the wrong operation. If order matters it is a permutation; if only the set of chosen items matters it is a combination. Permutations are always the larger number.
- Setting r above n. You cannot choose or arrange more items than exist; the tool rejects it and asks for r between 0 and n.
- Expecting exact digits for huge results. 170! has well over 300 digits, so it is reported as a rounded coefficient and a power of ten.
- Forgetting that 0! equals 1. It is a definition, not a multiplication, and it keeps the combination formula working for r = 0.
- Assuming P(n, r) and C(n, r) differ by a fixed amount. They differ by a factor of r!, which grows quickly.
What is the difference between a permutation and a combination?
A permutation counts arrangements in which order matters, so ABC and CBA are two different outcomes. A combination counts selections in which order does not matter, so ABC and CBA are the same choice. Dividing the permutation count by r! removes the duplicate orderings and converts one into the other.
Why is 0! equal to 1?
There is exactly one way to arrange nothing, namely to do nothing. Defining 0! as 1 also makes the recurrence n! = n × (n−1)! hold at n = 1 and keeps the combination formula correct when you choose none of the items.
How do I tell whether a problem needs a permutation or a combination?
Ask whether swapping two chosen items produces a different result. Race finishes, seating orders, and passwords are permutations because position matters. Lottery tickets, committees, and card hands are combinations because only membership matters. If the word “arrange” or “order” appears, it is usually a permutation.
Why is the maximum n set to 170?
Because 170! is the largest factorial that still fits inside a standard double-precision number. Above that the logarithm exceeds the range and the tool would only be able to return an overflow, so the input is capped instead.
For experiments that produce the outcomes being counted, the random number generator is a natural next stop, and the standard deviation calculator summarises numeric results from repeated trials.