Factorial Calculator (n!)
Enter a non-negative integer n to compute the factorial n! exactly, along with its digit count, Stirling approximation, and the previous factorial. Large values are shown in scientific notation.
Last updated:
Input
Enter a non-negative integer n to compute its factorial n!=1×2×…×n.
Example: enter 10 to compute 10!. Note that 0! equals 1.
Result
Value of 10!
3,628,800
Number of digits
7
Stirling approximation
3.59869562 × 10 to the power 6
Value of (10−1)!
362,880
The Stirling approximation n!≈√(2πn)×(n/e)^n becomes relatively more accurate as n grows.
How it works
- The factorial is defined as n!=1×2×3×…×n, with 0!=1.
- The exact value is computed with big integers, so there is no rounding overflow.
- The digit count uses the sum of common logarithms log10(1)+log10(2)+…+log10(n).
- Stirling approximation n!≈√(2πn)×(n/e)^n is shown as a reference for large n.
- When the result has many digits, it is displayed as a mantissa times ten to a power in scientific notation.
Frequently asked questions
- How is the factorial n! calculated, and what is 0!?
- It is computed as n!=1×2×3×…×n, with 0! defined as 1. For example, 5!=1×2×3×4×5=120.
- Does it stay exact for very large n?
- Yes. It uses arbitrary-precision (big) integers, so there is no rounding error from overflow. When the result has many digits it is also shown in scientific notation.
- How are the digit count and Stirling approximation used?
- The digit count comes from the sum log10(1)+log10(2)+…+log10(n), and Stirling's approximation n!≈√(2πn)×(n/e)^n is shown as a quick estimate for large n.
Reviews
Tell us what you think of this calculator.
Write a review
Found an incorrect result or a problem? Turn this on to report it.
Rating