ponderloop.com

Factorial Calculator

What to calculate

A whole number from 0 to 10,000. Decimals, fractions and negatives are not supported: they need the gamma function.

20! = 20 × 19 × 18 × … × 2 × 1

20! = 2,432,902,008,176,640,000

19 digits, 4 trailing zeros

Number of digits
19
Scientific notation
2.43290200818 × 10¹⁸
Trailing zeros
4
Stirling’s approximation
≈ 2.42279 × 10¹⁸
Stirling’s relative error
0.416% below 20!
Rule of thumb 1 ÷ (12n)
0.417%

The working

  1. 20! = 20 × 19 × 18 × … × 2 × 1 = 2,432,902,008,176,640,000.
  2. The result has 19 digits: ⌊log₁₀(20!)⌋ + 1 = 18 + 1.
  3. Every trailing zero is a factor 10 = 2 × 5, and n! has far more 2s than 5s, so count the 5s with Legendre’s formula: ⌊20 ÷ 5⌋ = 4 trailing zeros.
  4. Stirling’s approximation √(2π·20) × (20 ÷ e)^20 ≈ 2.42279 × 10¹⁸, which is 0.416% below the exact 20!; the error is close to 1 ÷ (12n) = 0.417%.