How factorial calculator works
The factorial of a non-negative integer n, written as n!, is the product of all positive integers less than or equal to n. For example, 5! = 5 times 4 times 3 times 2 times 1 = 120. By convention, 0! = 1.
Factorials grow extremely fast. 10! is already 3,628,800, and 20! exceeds 2 quintillion. JavaScript can represent factorials up to 170! before exceeding the maximum representable floating-point number.
Factorials are fundamental in combinatorics and probability. They count the number of ways to arrange n distinct objects (permutations), and appear in binomial coefficients, the Poisson distribution, and Taylor series expansions.