Factorial Calculator

Calculate the factorial of any non-negative integer. Essential for permutations, combinations, and probability calculations.

Enter your values above to see the results.

Tips & Notes

  • 0! = 1 by definition. Required for C(n,0)=1 — one way to choose nothing from any set.
  • P(n,r) = C(n,r) × r! — permutations equal combinations times the number of arrangements. P(5,3) = 10×6 = 60.
  • C(n,r) = C(n, n−r). Choosing 3 from 10 equals leaving 7: C(10,3)=C(10,7)=120. Always use the smaller r.
  • P(n,n) = n! — total arrangements of all n items. Five books: 5! = 120 ways.
  • Standard calculators overflow at 171!. Use scientific notation for n > 20.

Common Mistakes

  • Treating 0! as 0. If 0!=0, all combination formulas break since C(n,0) would equal 0 instead of 1.
  • Using n! instead of P(n,r) when selecting r items from n — arranging 3 from 10 is P(10,3)=720 not 10!=3,628,800.
  • Using P(n,r) instead of C(n,r) when order does not matter — choosing a 3-person committee is C(10,3)=120 not 720.
  • Computing P(n,r) with one too many terms: P(8,3) = 8×7×6 = 336, not 8×7×6×5 = 1,680.
  • Using C(n,r) when r > n — undefined. If r > n in your problem, recheck the setup.

Factorial Calculator Overview

The factorial of a non-negative integer n (written n!) is the product of all positive integers from 1 to n. Factorials grow extraordinarily rapidly — faster than any exponential function — and are the foundation of combinatorics, probability, and analysis. They appear in permutation formulas (counting ordered arrangements), combination formulas (counting unordered selections), binomial theorem expansions, Taylor series, and the Gamma function that extends factorials to non-integers.

The definition:

n! = n × (n−1) × (n−2) × ... × 2 × 1
EX: 5! = 5×4×3×2×1 = 120 | 7! = 5040 | 10! = 3,628,800 | 15! = 1,307,674,368,000
By definition: 0! = 1 — the empty product equals 1, required for combination formulas to work at the boundaries C(n,0)=1 and C(n,n)=1. Recursive relationship: n! = n × (n−1)! — each factorial is built from the one below it:
EX: 6! = 6 × 5! = 6 × 120 = 720 | 8! = 8 × 7! = 8 × 5040 = 40,320
Permutations and combinations — the primary applications of factorial:
P(n,r) = n!/(n−r)! — ordered selections | C(n,r) = n!/[r!(n−r)!] — unordered selections
EX: Arrange 3 books from 8: P(8,3) = 8!/5! = 8×7×6 = 336 | Choose 3 from 8: C(8,3) = 336/6 = 56
Factorial growth scale: 10! = 3,628,800 | 20! ≈ 2.4×10¹⁸ | 70! ≈ 1.2×10¹⁰⁰ (exceeds atoms in the universe ≈10⁸⁰) | 100! ≈ 9.3×10¹⁵⁷ Standard floating-point: overflows at 171! (result becomes Infinity). This calculator handles large factorials with arbitrary precision. Stirling's approximation for large n: n! ≈ √(2πn) × (n/e)ⁿ. For n=10: exact=3,628,800; Stirling gives ≈3,598,696 (error <1%). Accuracy improves as n increases. Probability applications: Binomial probability P(k successes in n trials) = C(n,k) × pᵏ × (1−p)^(n−k). Probability of exactly 3 heads in 10 fair coin flips = C(10,3) × (0.5)³ × (0.5)⁷ = 120 × (1/1024) ≈ 11.7%. The Gamma function Γ(n) = (n−1)! extends factorials to all positive reals and complex numbers. Γ(1/2) = √π ≈ 1.7725. This means (0.5)! = Γ(1.5) = 0.5 × Γ(0.5) = √π/2 ≈ 0.886. The Gamma function appears throughout statistics (chi-squared, t, and F distributions), quantum mechanics, and complex analysis.

Frequently Asked Questions

Factorial of n (written n!) is the product of all positive integers from 1 to n. n! = n × (n−1) × (n−2) × ... × 2 × 1. Examples: 5! = 5×4×3×2×1 = 120. 10! = 3,628,800. 0! = 1 by definition (the empty product). Factorials grow extremely rapidly: 20! ≈ 2.4 × 10¹⁸, and 100! has 158 digits. Factorials count the number of ways to arrange n distinct objects in a sequence (permutations).

0! = 1 by mathematical convention, not arbitrary choice. The pattern: 4! = 24, 3! = 6, 2! = 2, 1! = 1. Each step divides the previous by the current n: 4!/4 = 6 = 3!, 3!/3 = 2 = 2!, 2!/2 = 1 = 1!, 1!/1 = 1 = 0!. The recursive definition n! = n × (n−1)! requires 0! = 1 to terminate. Also, the number of ways to arrange zero objects is exactly one way (do nothing). The combinatorial formula C(n,0) = n!/(0!×n!) = 1 requires 0! = 1.

Permutations P(n,r) = n!/(n−r)! count ordered arrangements. Combinations C(n,r) = n!/(r!(n−r)!) count unordered selections. Example: choosing 3 officers (president, VP, secretary) from 10 people — order matters: P(10,3) = 10!/7! = 10×9×8 = 720. Choosing 3 committee members from 10 — order does not matter: C(10,3) = 10!/(3!×7!) = 120. Factorials appear in the denominator to cancel overcounting of equivalent arrangements.

Factorials grow faster than exponential functions. n! eventually exceeds cⁿ for any fixed constant c. 10! = 3,628,800 while 2¹⁰ = 1,024 and 10¹⁰ = 10,000,000,000. But 100! ≈ 9.3 × 10¹⁵⁷ while 10¹⁰⁰ = googol. The Stirling approximation estimates large factorials: n! ≈ √(2πn) × (n/e)ⁿ. This approximation is accurate to within 1% for n ≥ 10 and is used in statistical mechanics and probability theory to handle large n without computing full factorials.

The number of trailing zeros in n! equals the number of times 10 divides n!, which equals the number of times 5 divides n! (since 2s are more plentiful than 5s). Count: ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + ... Example: trailing zeros in 100! = ⌊100/5⌋ + ⌊100/25⌋ + ⌊100/125⌋ = 20 + 4 + 0 = 24 trailing zeros. So 100! ends in exactly 24 zeros. This technique avoids computing the enormous full value of 100!

Taylor series express functions as infinite sums involving factorials. eˣ = 1 + x/1! + x²/2! + x³/3! + ... = Σ xⁿ/n!. sin(x) = x − x³/3! + x⁵/5! − ... cos(x) = 1 − x²/2! + x⁴/4! − ... The factorials in the denominators ensure the series converges — each term shrinks faster than the previous because n! grows much faster than xⁿ. These series form the foundation of calculus, differential equations, and numerical computing.