ADVERTISEMENT

Mobile Banner
320×100

Factorial Calculator

Calculate factorials (n!) for permutations, combinations, and probability

Factorial Formulas

Factorial Definition
Loading formula...
Recursive Form
Loading formula...
Special Cases
Loading formula...
!

What is a Factorial?

A factorial, denoted by n!, is the product of all positive integers from 1 to n. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120. Factorials are fundamental in mathematics, particularly in counting, probability, and combinatorics.

The factorial function grows extremely rapidly. While 5! = 120, by the time you reach 10! you get 3,628,800, and 20! exceeds 2 quintillion. This rapid growth makes factorials important in complexity analysis and algorithm design.

By convention, 0! is defined as 1. This isn't intuitive, but it's necessary for many mathematical formulas to work correctly, especially in combinatorics where choosing 0 items from a set should give exactly 1 way (choosing nothing).

Applications of Factorials

🔢

Permutations

P(n,r) = n!/(n-r)! counts arrangements where order matters.

🎯

Combinations

C(n,r) = n!/[r!(n-r)!] counts selections where order doesn't matter.

🎲

Probability

Used in binomial distribution, Poisson distribution, and other probability calculations.

📈

Taylor Series

Factorials appear in denominators of Taylor series expansions for sin, cos, e^x.

Common Factorial Values

Here are the first 15 factorial values for quick reference:

nn!DigitsUses
0 1 1 By definition
1 1 1 Base case
5 120 3 Hand arrangements
7 5,040 4 Week permutations
10 3,628,800 7 Digit arrangements
12 479,001,600 9 Month permutations
15 1,307,674,368,000 13 Large calculations

Important Factorial Properties

🔄

Recursive Property

n! = n × (n-1)!. This property is useful for computing factorials programmatically and understanding factorial relationships.

📊

Stirling's Approximation

For large n: n! ≈ √(2πn)(n/e)^n. This approximation is useful when exact factorials are too large to compute.

0️⃣

Trailing Zeros

The number of trailing zeros in n! equals floor(n/5) + floor(n/25) + floor(n/125) + ... This counts how many times 10 divides n!.

Gamma Function

Factorials extend to non-integers via Γ(n+1) = n!. The gamma function allows factorial-like calculations for any positive real number.

Frequently Asked Questions

Why is 0! equal to 1?

By convention and for mathematical consistency. The empty product (multiplying no numbers) is 1, and this makes formulas like C(n,0) = n!/(0!×n!) = 1 work correctly.

Can you calculate factorial of negative numbers?

No, factorials are only defined for non-negative integers. However, the gamma function Γ(n) extends the concept to complex numbers except negative integers.

What's the largest factorial a calculator can handle?

Most calculators overflow around 170! which exceeds 10^300. This calculator uses special techniques to display larger factorials as scientific notation.

How do I calculate double factorial?

Double factorial n!! means multiplying every other number: 7!! = 7×5×3×1 = 105. It's not (n!)! but a separate operation used in combinatorics.

Examples

Arranging 7 books on a shelf

You want to know how many distinct ways 7 different books can be ordered on a shelf — a classic permutation problem solved with a factorial.

Result7! = 5,040 arrangements

Multiply 7 × 6 × 5 × 4 × 3 × 2 × 1. There are 7 choices for the first slot, 6 for the second, and so on down to 1. The product is 5,040, the same value that appears inside permutation formulas like P(n, r) = n! / (n − r)!.

Frequently asked questions

Why is 0! defined as 1?

0! = 1 is a convention chosen so that core formulas stay consistent. The empty product of no factors is 1, and definitions like C(n, 0) = n! / (0! · n!) = 1 and the Taylor series 1 + x/1! + x²/2! + … only work if 0! equals 1.

Where do factorials show up in real math problems?

Factorials appear throughout probability, combinatorics, and calculus. Permutations P(n, r) = n! / (n − r)! and combinations C(n, r) = n! / [r!(n − r)!] count arrangements and selections, the binomial and Poisson distributions use them, and Taylor series for e^x, sin x, and cos x divide each term by k!.

What is Stirling's approximation and when should I use it?

Stirling's approximation says n! ≈ √(2πn) · (n/e)^n for large n. It is useful when exact factorials are too large to store or when you only need orders of magnitude, such as in statistical mechanics, information theory, or analyzing algorithm complexity. The relative error shrinks as n grows.

How does the gamma function extend factorials?

The gamma function Γ(z) is defined by an integral and satisfies Γ(n + 1) = n! for non-negative integers n. It extends factorials to all complex numbers except the non-positive integers, which lets you compute values like (1/2)! = √π / 2 used in statistics and physics.

What is a double factorial and how is it different from n!?

The double factorial n!! is the product of every other integer down to 1 or 2. For example, 7!! = 7 × 5 × 3 × 1 = 105 and 8!! = 8 × 6 × 4 × 2 = 384. It is not (n!)!, which would be a factorial of a factorial. Double factorials appear in formulas for the volume of n-balls and certain trigonometric integrals.

How fast does n! grow?

Faster than any exponential. 5! = 120, 10! = 3,628,800, and 20! ≈ 2.43 × 10^18. By 70! the result exceeds 10^100 (a googol), and 170! is near the upper limit of standard double-precision floating point at roughly 10^306.

Can I take the factorial of a negative number?

No. The factorial is only defined for non-negative integers. The gamma function extends the idea to other numbers, but Γ(z) has simple poles at z = 0, −1, −2, …, so negative integers still have no finite factorial value.

Sources

Pro Tips

  • Bookmark this calculator for quick access in the future
  • Use the share button to send your results to others
  • Try different scenarios to compare outcomes
  • Check out our related calculators for more insights

Found this calculator helpful? Share it with others:

Embed this calculator