Factorial Calculator

n factorial equals n times n minus 1 times dot dot dot times 2 times 1

Solution

Share:

How It 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. By definition, 0! = 1. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials grow extremely fast and are fundamental in combinatorics, probability, and algebra.

Example Problem

Find 7!:

  1. Start with 7 and multiply downward: 7 × 6 = 42.
  2. 42 × 5 = 210.
  3. 210 × 4 = 840.
  4. 840 × 3 = 2,520.
  5. 2,520 × 2 = 5,040.
  6. 5,040 × 1 = 5,040.

Therefore, 7! = 5,040.

Frequently Asked Questions

Why is 0! equal to 1?

By convention, 0! = 1. This is because the product of zero factors is the multiplicative identity (1), and it ensures that formulas like the binomial coefficient and permutations work correctly for edge cases.

What is the largest factorial this calculator supports?

This calculator supports values up to 170!. Beyond 170, the result exceeds the range of standard JavaScript floating-point numbers (approximately 10³&sup0;&sup8;). The exact integer result is computed using high-precision arithmetic.

Where are factorials used?

Factorials appear in permutations (n!), combinations (n! / (k!(n − k)!)), Taylor series expansions, probability distributions, and many areas of discrete mathematics and computer science.

Can you take the factorial of a negative number?

The factorial function is only defined for non-negative integers. The gamma function extends the concept to all complex numbers except negative integers, where Γ(n + 1) = n! for non-negative integers.

How fast do factorials grow?

Factorials grow faster than exponential functions. While 10! = 3,628,800, by 20! the result is already over 2.4 quintillion (2,432,902,008,176,640,000). Stirling's approximation n! ≈ √(2πn)(n/e)ⁿ is often used for large n.

Related Calculators