Factorial Calculator

Free factorial calculator. Find the factorial of any positive integer instantly. Includes explanation of factorials and permutations.

Free Tool No Sign-up Instant Results

Factorial Calculator

Comprehensive Guide: Factorials (n!), Growth Rates & Stirling’s Approximation

Understand combinatorial explosion, why 0! = 1, recursive algorithms, trailing zeros, and the continuous Gamma function.

1

1. Mathematical Definition of the Factorial Operation

For any non-negative integer n, the factorial (denoted by the exclamation mark n!) represents the product of all positive integers less than or equal to n:

n! = n × (n − 1) × (n − 2) × ... × 3 × 2 × 1   (for n ≥ 1)
0! = 1   (by fundamental combinatorial definition)
2

2. Why Does 0! = 1? Three Independent Mathematical Proofs

Students often find 0! = 1 counterintuitive. Three separate proofs establish this necessity:

  • Combinatorial Arrangement Proof: n! is the number of ways to arrange n objects. How many ways can you arrange zero objects? Exactly 1 way: the empty set (do nothing).
  • Recursive Algebraic Proof: Since n! = n × (n − 1)!, solving for (n − 1)! gives (n − 1)! = n! ÷ n. Setting n = 1: 0! = 1! ÷ 1 = 1 ÷ 1 = 1.
  • Preservation of nCr / nPr: If 0! were 0, computing ⁿCₙ = n! / [n! × 0!] would divide by zero. Defining 0! = 1 ensures ⁿCₙ = 1 holds universally.
3

3. Graduated Step-by-Step Worked Problems

Problem 1: Step-by-Step Expansion of 7!

Compute 7! by systematic sequential multiplication:
• 1! = 1
• 2! = 2 × 1 = 2
• 3! = 3 × 2 = 6
• 4! = 4 × 6 = 24
• 5! = 5 × 24 = 120
• 6! = 6 × 120 = 720
• 7! = 7 × 720 = 5,040.

Problem 2: Counting Trailing Zeros in 25!

How many trailing zeros are at the end of the number 25!?
• Trailing zeros are produced by factors of 10 (prime factors 2 and 5).
• Since factors of 2 are abundant, count factors of 5 using Legendre's Formula:
⌊25 / 5⌋ + ⌊25 / 25⌋ = 5 + 1 = 6 trailing zeros.
Result: 25! ends in exactly 6 consecutive zeros.

Problem 3: Permutations with Repetition (Anagram Counting)

How many distinct anagrams can be formed from the 6 letters of 'BANANA'?
• Total letters: 6. Repeating letters: 1 B, 3 A's, 2 N's.
• Formula: Distinct Permutations = 6! / (1! × 3! × 2!) = 720 / (1 × 6 × 2) = 720 / 12 = 60.
Result: Exactly 60 unique arrangements.

4

4. Combinatorial Explosion & Stirling’s Approximation

Factorials grow faster than exponential functions (n! >> aⁿ). While 5! = 120 and 10! = 3,628,800, 52! (permutations of a card deck) is approximately 8.0658 × 10⁶⁷—vastly larger than the number of atoms on Earth!

For immense numbers where exact integer multiplication is computationally prohibitive, Stirling’s Approximation predicts factorials with high precision: n! ≈ √(2πn) × (n / e)ⁿ.

5

5. Frequently Asked Questions (FAQ)

Can you take the factorial of a decimal or negative number?

In advanced mathematics, the continuous Gamma Function extends factorials to real and complex numbers: Γ(n) = (n − 1)!. For example, (1/2)! = Γ(1.5) = √π / 2 ≈ 0.8862. Negative integers remain undefined (poles with infinite values).

What is a double factorial (n!!)?

A double factorial multiplies only integers that share the same parity (odd/even) as n. For odd n: 7!! = 7 × 5 × 3 × 1 = 105. For even n: 8!! = 8 × 6 × 4 × 2 = 384.

How many unique ways can a standard 52-card deck be shuffled?

There are 52! ≈ 8.066 × 10⁶⁷ possible arrangements. Whenever you shuffle a deck properly, it is virtually certain that specific order has never existed before in human history.