Factorial calculator
Exact n! for whole numbers up to 1,000, plus permutations and combinations, computed with exact integer arithmetic.
Factorial result
10!
-
Factorial reference table
| n | n! |
|---|
Permutations and combinations
Permutations count ordered arrangements of r items from a set of n; combinations count unordered selections.
- PermutationsnPr = n! / (n - r)!
- -
- CombinationsnCr = n! / (r! (n - r)!)
- -
How it works
The factorial of a non-negative integer n, written n!, is the product of all positive integers from 1 to n, with 0! defined as 1 by convention.
- Enter n
Any whole number from 0 to 1,000.
- Read the exact value
Computed with exact integer arithmetic, never rounded.
- Try permutations or combinations
Enter n and r below to count arrangements or selections.
The factorial formula
n! = n × (n-1) × (n-2) × ... × 2 × 1
For example, 5! = 5 × 4 × 3 × 2 × 1 = 120, and 10! = 3,628,800. Factorials grow extremely fast: 20! already exceeds 2 quintillion, and 100! has 158 digits.
Why 0! equals 1
0! is defined as 1 by convention. This keeps formulas such as the combination C(n, 0) = n! / (0! × n!) = 1 working correctly, since there is exactly one way to choose nothing from a set. The empty product, a product with no factors, is 1 by the same convention.
Permutations and combinations
A permutation counts the number of ordered arrangements of r items chosen from n: nPr = n! / (n - r)!. A combination counts unordered selections: nCr = n! / (r! × (n - r)!). For example, choosing and ranking 3 medal winners from 10 runners is a permutation, 10P3 = 720, while simply choosing 3 finalists from 10 without ranking them is a combination, 10C3 = 120.
Exact arithmetic, no rounding
This calculator uses exact integer arithmetic rather than floating-point numbers, so every digit of the result is correct even for very large factorials, up to n equal to 1,000, which has 2,568 digits. A standard calculator that uses ordinary numbers loses precision, and shows Infinity, once a factorial exceeds about 1.8 × 10^308.
Frequently asked questions
What is a factorial and how is it calculated?
n! equals n times (n-1) times (n-2) and so on down to 2 times 1. For example, 5! equals 5 times 4 times 3 times 2 times 1, which is 120, and 10! equals 3,628,800. Factorials grow extremely fast: 20! already exceeds 2 quintillion. The calculator supports exact integer results up to 1,000! using exact integer arithmetic.
Why is 0! equal to 1?
0! equals 1 by definition and mathematical convention. It ensures that formulas like the combination C(n, 0) equals n! divided by 0! times n!, which equals 1, work correctly, since there is exactly one way to choose nothing from a set. The empty product, a product with no factors, is also 1 by convention.
What is the largest factorial this calculator can compute?
The calculator computes exact integer results up to 1,000!, which has 2,568 digits. It uses exact integer arithmetic rather than ordinary floating-point numbers, so there is no precision loss at any size within that range, unlike calculators that switch to Infinity once a result exceeds about 1.8 times 10 to the 308th power.
What are permutations and combinations, and how do they use factorials?
A permutation, nPr, counts ordered arrangements of r items chosen from n and equals n! divided by (n - r)!. A combination, nCr, counts unordered selections and equals n! divided by r! times (n - r)!. Both appear throughout probability and statistics for counting how many ways items can be arranged or selected.
Where are factorials used in real mathematics?
Factorials appear in combinatorics, including permutations and combinations, in probability, in Taylor series expansions such as e to the x equals the sum of x to the n over n!, and in statistics. They are fundamental to counting how many ways a set of items can be arranged or selected.