Factorial: worked example
| Whole number n | 10 |
|---|---|
| n factorial | 3,628,800 |
| Trailing zeros | 2 |
Factorial: formula
Enter a non-negative whole number n up to 170. The factorial n! is the product of all positive integers up to n, and zero factorial is defined as 1. Larger values exceed what standard floating-point numbers can hold.
The calculator also counts trailing zeros, using the formula that sums n divided by 5, 25, 125 and so on. Decimals and negatives do not have ordinary factorials.
Factorial: changing Whole number n
| Whole number n | n factorial | Trailing zeros |
|---|---|---|
| 8 | 40,320 | 1 |
| 9 | 362,880 | 1 |
| 10 (example) | 3,628,800 | 2 |
| 11 | 39,916,800 | 2 |
| 12 | 479,001,600 | 2 |
Factorial: compare input ranges
| Input | Tested from | To | n factorial: low input | n factorial: high input | Swing |
|---|---|---|---|---|---|
| Whole number n | 9 | 11 | 362,880 | 39,916,800 | 39,553,920 (1090%) |
Factorial: individual input comparisons
| Input | Value | n factorial | Trailing zeros |
|---|---|---|---|
| Whole number n | 8 | 40,320 | 1 |
| 9 | 362,880 | 1 | |
| 10 | 3,628,800 | 2 | |
| 11 | 39,916,800 | 2 | |
| 12 | 479,001,600 | 2 |
Factorial: which assumptions move the result?
Factorial: values and definitions
| Quantity and definition | Value used |
|---|---|
| Whole number n — A whole number from 0 to 170. Beyond 170 the answer no longer fits in a computer's number format. | 10 |
| n factorial | 3,628,800 |
| Trailing zeros | 2 |
Factorial: half and double Whole number n
| Whole number n | n factorial |
|---|---|
| 5 | 120 |
| 10 | 3,628,800 |
| 20 | 2,432,902,008,176,640,000 |
Common error: Using n factorial when order does not matter. Choosing three people from ten as a group is a combination, which divides the factorial down; ten factorial itself counts every seating order.
This output uses floating-point arithmetic. Large integer factorials can lose exact integer precision even before overflow; the supported limit of 170 keeps the magnitude finite. Exact combinatorial work can require integer arithmetic.
The separate trailing-zero count does not depend on displaying every factorial digit.
Number Theory & Precision calculators: Modulo Calculator, Fibonacci Calculator, Prime Number Calculator, GCF & LCM Calculator, Prime Factorization Calculator, Scientific Notation Calculator.
Factorials outrun intuition fast. Ten factorial is 3,628,800. Twenty is past two quintillion.
The number counts the ways to order a set of items, so it tells you when listing every arrangement stops being an option and a formula or a sample is the only route. The trailing-zero count is a quick way to see how many times the product picks up a factor of ten.
Confirm the item count is whole and small enough. Above 170 the true answer exceeds what a computer number can hold, so the page stops there.
Count arrangements on the permutation and combination calculator, and chances on the probability and binomial pages. The scientific notation calculator helps read large results, and the exponent page shows how fast powers grow compared with factorials. The Fibonacci page covers another growing sequence.
Factorial Calculator: quantities and terminology
How many trailing zeros does a factorial have?
One for each factor of 10, and since fives are scarcer than twos, count the factors of 5: divide n by 5, 25, 125 and add the whole parts.
What is a factorial?
The product of all positive whole numbers up to n. For example 5 factorial is 5 times 4 times 3 times 2 times 1, or 120.
Why is 0 factorial equal to 1?
By convention, because there is exactly one way to arrange zero items, and it keeps formulas for combinations consistent.