Factorial Calculator

Calculate factorial

Enter a non-negative whole number. The calculator shows the product pattern and domain limit.

Use an integer from 0 to 170.

What is a Factorial?

The factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120.

Factorials are fundamental in mathematics, particularly in combinatorics, probability, and calculus. They are used to calculate permutations, combinations, and appear in Taylor series expansions and the Gamma function.

How Factorials Are Calculated

Follow these detailed steps:

  1. Step 1: Identify n
    Find the number for which you need n!. For permutations of 7 items, n = 7.
  2. Step 2: Calculate the Product
    Multiply all integers from n down to 1: n! = n × (n-1) × (n-2) × ... × 2 × 1. For 5!: 5 × 4 × 3 × 2 × 1 = 120.
  3. Step 3: Apply to Problem
    Use in permutation P(n,r) = n!/(n-r)! or combination C(n,r) = n!/(r!(n-r)!) formulas.

Formula

n! = n × (n-1) × (n-2) × ... × 2 × 1

0! = 1
1! = 1

Recursive definition:

n! = n × (n-1)! for n > 0
0! = 1

Examples

Calculate 6!

Problem: Find the factorial of 6.

Solution:

  1. 6! = 6 × 5 × 4 × 3 × 2 × 1
  2. 6 × 5 = 30
  3. 30 × 4 = 120
  4. 120 × 3 = 360
  5. 360 × 2 = 720
  6. 720 × 1 = 720
  7. Result: 6! = 720

Factorial Growth Rate

Factorials grow extremely quickly:

  • 5! = 120
  • 10! = 3,628,800
  • 15! = 1,307,674,368,000
  • 20! = 2,432,902,008,176,640,000

Quick Calculation Tips

  • 0! = 1 by definition (there's one way to arrange nothing)
  • n! grows very fast: 10! ≈ 3.6 million, 20! ≈ 2.4 quintillion
  • Use Stirling's approximation for large n: n! ≈ √(2πn)(n/e)ⁿ
  • In probability, factorials appear in binomial coefficients

Common Mistakes to Avoid

  • Factorial of negative numbers
    Factorial is only defined for non-negative integers. (-3)! doesn't exist.
  • Underestimating growth
    20! has 19 digits. Factorials grow faster than exponential functions.

Frequently Asked Questions

Why does 0! equal 1?

By definition, 0! = 1. This makes mathematical formulas work consistently. For example, there is exactly one way to arrange zero objects (do nothing), and formulas like n!/((n-k)! × k!) work for all valid values including when k = 0 or k = n.

What is the largest factorial calculators can handle?

In standard JavaScript (which this calculator uses), factorials up to 170! can be accurately represented. 171! exceeds the maximum safe floating-point value. For larger factorials, special arbitrary-precision libraries are needed.

What are factorials used for?

Factorials are essential in: calculating permutations (arrangements) and combinations (selections), probability calculations, Taylor series in calculus, and the Gamma function which extends factorials to non-integers.

Can you calculate the factorial of a negative number?

Factorials are only defined for non-negative integers. However, the Gamma function extends the concept to other numbers, with Gamma(n) = (n-1)! for positive integers.