HerHesap
TREN

Factorial Calculator (n!)

Enter a whole number to get n! exactly up to 10,000 and in scientific notation beyond. The digit count, the trailing zeros and Stirling’s approximation are worked out too.

Last updated:

A whole number from 0 to 1,000,000. The exact value is worked out up to 10,000.

Value of 10!3,628,80010! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 3,628,800
  • Number of digits7
  • Trailing zeros2
  • Sum of its digits27
  • Scientific notation3.6288 × 10⁶
  • Stirling’s approximation √(2πn)·(n/e)ⁿ3.5987 × 10⁶
  • Error of Stirling’s approximation0.83%
Step by step: 1! to n! 10

How it is calculated

The factorial counts the ways to put n different objects in order: 5 people can stand in a row in 5! = 120 ways. It underlies permutations, combinations and probability. It grows very fast: 20! already has 19 digits, which is why calculators and spreadsheets give up after 170!; this tool uses exact integer arithmetic and shows every digit.

Formulan! = n × (n − 1) × … × 2 × 1 · 0! = 1n: zero or a positive whole number. Trailing zeros (Legendre): ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + … · Stirling: n! ≈ √(2πn)·(n/e)ⁿ.
  1. Every whole number from 1 to n is multiplied; 0! is 1 by definition.
  2. The product uses exact integer arithmetic (BigInt), with no rounding.
  3. A result longer than 15 digits is summarised in scientific notation; every digit is listed in the table, 24 per row.
  4. For n above 10,000 the digit count and the scientific form come from Stirling’s series.

Example

10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 3,628,800. Stirling’s approximation gives 3,598,695.6, 0.83% short. 100! has 158 digits, ends in 24 zeros (100/5 + 100/25 = 24) and its digits add up to 648.

Frequently asked questions

Why is 0! equal to 1?

A set with no objects can be arranged in exactly one way: by doing nothing. The rule n! = n × (n − 1)! also needs 1! = 1 × 0!, which forces 0! = 1.

How many digits does 100! have, and how many trailing zeros?

100! has 158 digits. Its trailing zeros come from the factors 5 among 1–100 (factors 2 are always more plentiful): 100/5 = 20 and 100/25 = 4, so 24 zeros.

Why can’t a spreadsheet or calculator do 171!?

They use floating-point numbers, which top out near 1.8 × 10³⁰⁸; 171! is bigger. They also round after 15–17 digits. This tool uses exact integer arithmetic, so all 35,660 digits of 10,000! are right.

Do fractions or negative numbers have factorials?

The factorial is defined for zero and positive whole numbers only. The gamma function extends it to fractions (Γ(n + 1) = n!, e.g. Γ(1.5) = √π/2); at negative whole numbers the gamma function is undefined.

Source

With your permission, we use Google Analytics cookies to understand how the site is used. If you refuse, no cookies are stored. Cookie policy