CompoundPage

Factorial Calculator

Enter n and the factorial calculator multiplies every whole number from n down to 1, exactly, then counts the digits and the zeros at the end.

A whole number from 0 to 10,000.

52!8.06582 × 10^67

52!
80,658,175,170,943,878,571,660,636,856,403,766,975,289,505,440,883,277,824,000,000,000,000
The product Every whole number from n down to 1, multiplied together.
52 × 51 × 50 × ... × 1
Number of digits In scientific notation, 8.06582 × 10^67.
68
Trailing zeros Legendre's formula: floor(52/5) + floor(52/25) = 10 + 2 = 12. Each zero needs a 10 = 2 × 5, and factors of 5 are the scarcer ones.
12
Stirling's approximation √(2πn) × (n/e)^n, 0.16% below the exact value. The error is close to 1/(12n), so it shrinks as n grows.
8.05290 × 10^67
Double factorial, 52!! Every other number: 52 × 50 × 48 × ... × 2. Not the factorial of the factorial.
27,064,431,817,106,664,380,040,216,576,000,000
52! / 51! n! = n × (n - 1)!, so each factorial is the one before times n.
52
Factorials near 52
n!ValueDigitsTrailing zeros
48!1.24139 × 10^616210
49!6.08282 × 10^626310
50!3.04141 × 10^646512
51!1.55112 × 10^666712
52!8.06582 × 10^676812
53!4.27488 × 10^697012
54!2.30844 × 10^717212
55!1.26964 × 10^737413
56!7.10999 × 10^747513
  • Computed in exact whole-number arithmetic. Scientific notation is used only for display, and its leading digits are the true leading digits.

How the Factorial Calculator works

The factorial of a whole number n, written n!, is the product of every whole number from n down to 1. So 5! = 5 × 4 × 3 × 2 × 1 = 120, and 10! = 3,628,800. It counts the ways to put n distinct things in order: 5 books on a shelf can be arranged in 120 ways, because there are 5 choices for the first place, 4 for the second, and so on down to 1.

0! is 1. That is a definition, but a forced one. There is exactly one way to arrange nothing, and n! = n × (n - 1)! only holds at n = 1 if 0! = 1. Factorials of negative integers are not defined.

Factorials get large fast. 20! = 2,432,902,008,176,640,000 is the largest that fits in a signed 64-bit integer. The default above is 52!, the number of orders of a shuffled deck of cards. It is 68 digits long, about 8.07 × 10^67, so a well-shuffled deck is almost certainly in an order no deck has been in before. A phone or spreadsheet calculator shows an error from 171! on, because 170! is about 7.3 × 10^306 and floating-point numbers stop near 1.8 × 10^308. This factorial calculator multiplies in exact whole numbers up to 10,000!, which has 35,660 digits.

Trailing zeros. The zeros at the end of n! come from factors of 10, and each 10 is a 2 times a 5. There are always more 2s than 5s, so the count of 5s decides. Legendre's formula counts them: floor(n/5) + floor(n/25) + floor(n/125) and so on. For 52! that is 10 + 2 = 12 zeros. For 100! it is 20 + 4 = 24, out of 158 digits.

Stirling's approximation. For large n, n! ≈ √(2πn) × (n/e)^n. It is about 1/(12n) too low: at n = 10 it gives 3,598,696, which is 0.83% under 3,628,800, and at n = 100 the error is 0.083%. It is how probability and physics handle factorials too big to write down.

Where factorials appear. Permutations and combinations are ratios of factorials: P(n, r) = n! / (n - r)! and C(n, r) = n! / (r! (n - r)!). The combination calculator works those out without building the full factorials. Factorials are also the denominators of Taylor series, as in e = 1/0! + 1/1! + 1/2! + 1/3! + ..., and of the Poisson distribution.

Double factorial. n!! multiplies every other number: 9!! = 9 × 7 × 5 × 3 × 1 = 945. It is not (9!)!, which would be unimaginably larger.

Factorial Calculator FAQ

What is a factorial?

n! is the product of the whole numbers from 1 to n. 5! = 5 × 4 × 3 × 2 × 1 = 120. It counts the ways to arrange n distinct items in a row.

Why is 0! equal to 1?

There is one way to arrange zero items, the empty arrangement, and the rule n! = n × (n - 1)! needs 0! = 1 to give 1! = 1. It also makes the combination formula C(n, 0) = 1 work.

How many trailing zeros does 100! have?

24. Count the factors of 5: floor(100/5) + floor(100/25) = 20 + 4 = 24. Each pairs with a factor of 2 to make a 10.

Can you take the factorial of a decimal or a negative number?

Not as a product of whole numbers. The gamma function extends it, with x! = Γ(x + 1), so 0.5! = √π / 2, about 0.8862. It is undefined at the negative integers. This calculator takes whole numbers.

What is the largest factorial a calculator can show?

Most phone and spreadsheet calculators stop at 170!, about 7.3 × 10^306, because 171! is larger than the biggest floating-point number. Exact arithmetic has no such limit; this calculator goes to 10,000!.

Related calculators

Embed this calculator
<div id="compoundpage-factorial-calculator"></div>
<script src="https://compoundpage.com/embed/factorial-calculator.js" async></script>

The same calculation as JSON