1001Ferramentas
Calculators

Large Factorial Calculator

Calculate the factorial of large numbers (n!) with arbitrary precision using BigInt, with no lost digits. Ideal for combinatorics and probability.

n!

Factorial of large n

The factorial n! is the product 1 · 2 · 3 · ... · n. By convention 0! = 1, which lines up with the gamma function Γ(1) = 1. Growth is brutal. 10! = 3.628.800, 20! ≈ 2.43·10¹⁸, and 21! already overflows a 64-bit unsigned integer (2⁶⁴ ≈ 1.84·10¹⁹). Once you pass that you have to reach for arbitrary-precision integers: JavaScript's BigInt (ES2020+), Python's native int, Java's BigInteger, or a dedicated library. To give you a sense of scale, 100! ≈ 9,33·10¹⁵⁷ runs to 158 digits. When you only want a ballpark figure, Stirling's approximation is quick: n! ≈ √(2πn) · (n/e)ⁿ. The factorial also extends to real and complex numbers via the gamma function, where Γ(n+1) = n! for non-negative integers.

Applications

Factorials show up all over the place: in combinatorics (permutations of n objects), in probability (the binomial and Poisson distributions), in the Taylor series eˣ = Σ xⁿ/n!, in RSA and other corners of number theory, and in countless counting problems across computer science.

FAQ

Why is 0! = 1? Because it's the empty product, the product when there are no factors at all. Defining it that way keeps formulas like C(n,0) = n!/(0!·n!) = 1 working without special cases, and it agrees with Γ(1) = 1.

What is the maximum n in regular JavaScript? A Number (double precision) holds up to 170!; 171! tips over into Infinity. Switch to BigInt and the only ceiling is how much memory and time you're willing to spend.

Can we compute n! for non-integer n? Yes, the gamma function handles it, since n! = Γ(n+1). To take one case, (1/2)! = √π/2 ≈ 0,8862.

Related Tools

The results provided by this tool are for general informational and educational purposes only and do not constitute professional, financial, medical, legal, tax or accounting advice. Always confirm important decisions with a qualified professional and official sources.