n! Factorial Calculator (n!)

Factorial Result

What is a Factorial?

The factorial of a non-negative integer n, written as n!, is the product of all positive integers from 1 to n. Factorials are widely used in permutations, combinations, and probability.

n! = n × (n−1) × (n−2) × ... × 2 × 1
5! = 5 × 4 × 3 × 2 × 1 = 120

Factorial Table

0!
1 (by definition)
5!
120
10!
3,628,800
12!
479,001,600

Complete Factorial Table (0! to 20!)

nn! (Factorial)nn! (Factorial)
0!111!39,916,800
1!112!479,001,600
2!213!6,227,020,800
3!614!87,178,291,200
4!2415!1,307,674,368,000
5!12016!20,922,789,888,000
6!72017!355,687,428,096,000
7!5,04018!6,402,373,705,728,000
8!40,32019!121,645,100,408,832,000
9!362,88020!2,432,902,008,176,640,000
10!3,628,800

Factorial in Permutations and Combinations

Factorials are the building block of combinatorics — the mathematics of counting arrangements and selections.

Permutations P(n,r) = n! / (n−r)!
Combinations C(n,r) = n! / [r! × (n−r)!]
Arrangements of n distinct objects = n!
Example: 5 books on a shelf = 5! = 120 arrangements

Stirling's Approximation for Large Factorials

For very large n, Stirling's approximation provides a fast estimate:

n! ≈ √(2πn) × (n/e)ⁿ
100! ≈ 9.332 × 10¹⁵⁷ (a 158-digit number!)

Real-World Applications

  • Card games: A deck of 52 cards can be arranged in 52! ≈ 8×10⁶⁷ ways — more than the number of atoms in the observable universe
  • Password security: An 8-character password from 26 letters = 26⁸ ≈ 200 billion combinations
  • Genetics: Counting possible DNA sequences and gene arrangements
  • Probability: Calculating odds in games of chance, lottery combinations
  • Computer science: Algorithm complexity analysis — O(n!) algorithms are extremely slow

Factorial Growth — How Fast Numbers Explode

Factorials grow incredibly fast — faster than exponential functions. This is called super-exponential growth:

n2ⁿ (exponential)n! (factorial)Ratio n!/2ⁿ
5321203.75×
101,0243,628,8003,543×
1532,7681.307×10¹²39,900,000×
201,048,5762.432×10¹⁸2.3 trillion×

Why n! Matters in Computer Science

An algorithm with O(n!) time complexity is one of the slowest possible. For n=20, it requires over 2 quadrillion operations. The famous Travelling Salesman Problem (finding the shortest route visiting n cities) has n! possible routes — making brute force solutions impossible for large n.

Frequently Asked Questions

What is 0 factorial?
0! = 1. This is defined by convention and is essential for combinatorics formulas to work correctly when n = r.
What is 10 factorial?
10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 3,628,800.
Why are factorials used in combinations?
Factorials count the number of ways to arrange items. C(n,r) = n! / (r! × (n−r)!) uses factorials to count selections without regard to order.