What Is a Factorial?
The factorial of a whole number n, written n!, is the product of all positive whole numbers from 1 up to n. So 5! = 5 × 4 × 3 × 2 × 1 = 120. By definition 0! = 1, which makes many formulas work neatly. Factorials count the number of ways to arrange things. There are 5! = 120 ways to line up five people, and 52! ≈ 8 × 1067 ways to shuffle a deck of cards, more than the number of atoms on Earth.
Factorials grow astonishingly fast, faster than any exponential function. 10! is already 3,628,800, 20! has 19 digits, and 100! has 158. Ordinary calculators and spreadsheets overflow or round the result somewhere around 170!. This calculator uses exact big-integer arithmetic, so it shows every digit of factorials up to 10,000!, a number with 35,660 digits.
How to Calculate a Factorial
- Enter n, a whole number from 0 to 10,000.
- Choose the type: factorial, double factorial or subfactorial.
- Read the result in full or in scientific notation, with the number of digits and trailing zeros.
- Copy the exact value with one click.
Factorial Table
| n | n! | n | n! |
|---|---|---|---|
| 0 | 1 | 6 | 720 |
| 1 | 1 | 7 | 5,040 |
| 2 | 2 | 8 | 40,320 |
| 3 | 6 | 9 | 362,880 |
| 4 | 24 | 10 | 3,628,800 |
| 5 | 120 | 12 | 479,001,600 |
Where Factorials Are Used
- Permutations: arranging n different objects in order can be done in n! ways.
- Combinations: choosing r items from n uses n! ÷ (r! (n − r)!), the formula behind lottery odds.
- Probability and statistics: the binomial and Poisson distributions use factorials.
- Calculus: Taylor series such as ex = Σ xn/n! rely on factorials.
- Computer science: factorial time complexity describes brute-force searches like the travelling salesman problem.
Trailing Zeros in a Factorial
Each trailing zero comes from a factor of 10 = 2 × 5, and factorials always have more 2s than 5s. So the number of trailing zeros equals the number of factors of 5: ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …. For 100!, that's 20 + 4 = 24 trailing zeros. It's a classic interview and exam question, and the calculator confirms the answer instantly.
Double Factorials and Subfactorials
The double factorial n!! multiplies every other number: 9!! = 9 × 7 × 5 × 3 × 1 = 945, and 8!! = 8 × 6 × 4 × 2 = 384. It appears in physics and in formulas for volumes of spheres in higher dimensions. The subfactorial !n counts derangements: arrangements where nothing stays in its original place. With 4 letters and 4 envelopes, there are !4 = 9 ways for every letter to go in the wrong envelope. As n grows, !n ≈ n!/e, so the chance of a random shuffle being a derangement approaches 1/e ≈ 36.8%.
Features
- Exact resultsEvery digit up to 10,000!.
- Digit statisticsNumber of digits, trailing zeros and digit sum.
- Scientific notationFor quick understanding of huge values.
- Three typesn!, n!! and !n.
- Worked expansionShown for small n.
- One-click copyPaste the full number anywhere.
Factorials in Probability and Counting
Factorials count arrangements. There are 3! = 6 ways to order three books on a shelf, 10! = 3,628,800 ways to seat ten guests, and 52! ≈ 8.07 × 1067 ways to shuffle a deck of cards. That last number is so large that every properly shuffled deck in history has almost certainly been in an order never seen before. Factorials also form the basis of permutations and combinations: C(n, r) = n! / (r!(n − r)!) counts lottery tickets, poker hands and committee choices.
In calculus, factorials appear in Taylor series, such as e = 1/0! + 1/1! + 1/2! + 1/3! + …, and Stirling's approximation, n! ≈ √(2πn)(n/e)n, estimates huge factorials to within a fraction of a percent. The calculator gives the exact value with every digit, so there is no need to approximate.
Frequently Asked Questions
How many trailing zeros does 100! have?
24. Count the factors of 5: 100/5 + 100/25 = 20 + 4 = 24, since each pairs with a factor of 2 to make a 10.
Why is 0! equal to 1?
There's exactly one way to arrange zero objects (do nothing), and defining 0! = 1 keeps formulas like n! = n × (n−1)! consistent.
What is 100 factorial?
A 158-digit number starting 93326215443944… with 24 trailing zeros. Enter 100 to see every digit.
Can you take the factorial of a negative number or a decimal?
Not with the ordinary definition. The gamma function extends factorials to non-integers, where Γ(n+1) = n!.
Why does my calculator show an error for 171!?
171! exceeds the largest number standard floating-point can store (about 1.8 × 10308). This tool uses exact integers, so it has no such limit.
How fast do factorials grow?
Faster than exponentials. Stirling's approximation, n! ≈ √(2πn)(n/e)n, describes their growth.