Factorial Calculator
Compute the factorial n! of a non-negative integer n, defined as the product of all positive integers from 1 to n. Supports up to 170! before exceeding JavaScript precision limits.
About this Calculator
Compute the factorial n! of a non-negative integer n, defined as the product of all positive integers from 1 to n. Supports up to 170! before exceeding JavaScript precision limits.
Formula & Calculations
Formula
n! = 1 × 2 × 3 × ... × n, with 0! = 1 (by definition)Where:
- n=A non-negative integer (0 to 170)
- n!=The product of all integers from 1 to n
Assumptions
- 0! = 1 and 1! = 1 by definition.
- Maximum input is 170 due to JavaScript Number maximum safe integer limits. For larger values, the result is shown in scientific notation.
- Factorials grow extremely fast: 10! = 3,628,800 and 20! ≈ 2.43 × 10^18.
Calculation Examples
Example 1
5! = 5 × 4 × 3 × 2 × 1 = 120.
Example 2
By definition, the product of no numbers is the multiplicative identity, 1.
Frequently Asked Questions
Why is 0! equal to 1?
0! = 1 is a convention that makes many mathematical formulas work consistently, such as the formula for combinations C(n,0) = n!/(0!n!) = 1. It follows from the principle that an empty product equals 1.
How fast do factorials grow?
Factorials grow faster than exponential functions. 10! = 3.6 million, 20! ≈ 2.4 quintillion, and 100! has 158 digits. The calculator limits input to 170 to avoid exceeding JavaScript's safe integer range.