What Is a Factorial?
The factorial of a non-negative integer n, written n!, is the product of every positive integer from 1 up to n. For example, \(5! = 1 \times 2 \times 3 \times 4 \times 5 = 120\). By mathematical convention, \(0! = 1\) (the empty product). Factorials grow extremely fast — 10! is already over three million — so this calculator supports values from 0 up to 170, the largest factorial that fits in a standard double-precision number.
How to Use the Calculator
Enter a whole number n between 0 and 170 and the tool instantly returns n!. There is nothing else to configure: factorials are defined only for non-negative integers, so any decimals or negatives are not accepted. The result panel shows the full computed value of n!.
The Formula Explained
Mathematically, $$\text{n}! = \prod_{i=1}^{\text{n}} i = 1 \times 2 \times 3 \times \cdots \times \text{n}$$ It can also be written recursively as \(n! = n \times (n - 1)!\), with the base case \(0! = 1\). Each step simply multiplies the running product by the next integer. Factorials count the number of ways to arrange n distinct objects in order (permutations), which is why they appear throughout combinatorics, probability, and series expansions.
Worked Example
To find 6!, multiply step by step: \(1 \times 2 = 2\), \(\times 3 = 6\), \(\times 4 = 24\), \(\times 5 = 120\), \(\times 6 = 720\). So $$6! = 720$$ This means there are 720 different ways to order six distinct items.
Factorial Values for n = 0 to 20
The factorial \(n!\) is the product of all positive integers up to \(n\), with the convention \(0! = 1\). Each value follows from the previous one: \(n! = n \times (n-1)!\).
| n | n! |
|---|---|
| 0 | 1 |
| 1 | 1 |
| 2 | 2 |
| 3 | 6 |
| 4 | 24 |
| 5 | 120 |
| 6 | 720 |
| 7 | 5,040 |
| 8 | 40,320 |
| 9 | 362,880 |
| 10 | 3,628,800 |
| 11 | 39,916,800 |
| 12 | 479,001,600 |
| 13 | 6,227,020,800 |
| 14 | 87,178,291,200 |
| 15 | 1,307,674,368,000 |
| 16 | 20,922,789,888,000 |
| 17 | 355,687,428,096,000 |
| 18 | 6,402,373,705,728,000 |
| 19 | 121,645,100,408,832,000 |
| 20 | 2,432,902,008,176,640,000 |
Larger landmarks (approximate, scientific notation)
| n | n! (approx.) |
|---|---|
| 25 | 1.551 × 1025 |
| 50 | 3.041 × 1064 |
| 100 | 9.333 × 10157 |
| 170 | 7.257 × 10306 |
170 is the largest whole number whose factorial fits in a standard 64-bit floating-point number (maximum about 1.8 × 10308); 171! exceeds that limit, which is why this calculator accepts n from 0 to 170.
Interpreting Large Factorial Results
Exactness and rounding. Standard double-precision floating-point numbers store integers exactly only up to \(2^{53} = 9{,}007{,}199{,}254{,}740{,}992 \approx 9.007 \times 10^{15}\). Since \(18! \approx 6.40 \times 10^{15}\) is still below this limit and \(19! \approx 1.22 \times 10^{17}\) is the first factorial above it, results from 19! upward may have rounded trailing digits when computed in ordinary floating-point. Treat large values, especially those shown in scientific notation, as approximations of the true integer.
Growth. Factorials grow faster than any exponential. 20! already has 19 digits, and 100! has 158 digits. The number of digits of \(n!\) is \(\lfloor \log_{10}(n!) \rfloor + 1\). 170! has 307 digits (about 7.26 × 10306).
Permutations. \(n!\) counts the ways to arrange \(n\) distinct items in order. For example, 5 books on a shelf can be ordered in \(5! = 120\) ways, and a 52-card deck can be ordered in \(52! \approx 8.07 \times 10^{67}\) ways.
Sanity check with Stirling's approximation. For large \(n\):
$$n! \approx \sqrt{2\pi n}\,\left(\frac{n}{e}\right)^{n}$$
Worked check for \(n = 10\): \(\sqrt{2\pi \cdot 10} \approx 7.927\) and \((10/e)^{10} \approx 4.540 \times 10^{5}\), so \(10! \approx 7.927 \times 4.540 \times 10^{5} \approx 3.599 \times 10^{6}\). The exact value is 3628800, so Stirling is about 0.8% low. The relative error shrinks as \(n\) grows (roughly \(1/(12n)\)), making it a handy order-of-magnitude check for big results.
FAQ
Why is 0! equal to 1? The factorial counts permutations, and there is exactly one way to arrange zero objects (the empty arrangement). It also keeps formulas like nCr consistent.
Can I compute the factorial of a decimal? Not with the basic factorial. Extending factorials to non-integers requires the Gamma function, which this calculator does not cover.
Why stop at 170? \(170! \approx 7.26 \times 10^{306}\) is the largest factorial below the maximum value a double-precision floating-point number can hold; 171! overflows to infinity.