Factorial Calculator
Calculate factorials (n!), permutations P(n,r), and combinations C(n,r) with detailed explanations.
Calculator
Calculation Type:
Maximum: 170 (larger values overflow)
Quick Values:
5!
120
Expansion:
5! = 5 × 4 × 3 × 2 × 1
Related:
Common Factorials
0!
1
1!
1
2!
2
3!
6
4!
24
5!
120
6!
720
7!
5,040
8!
40,320
9!
362,880
10!
3,628,800
Formulas
Factorial
n! = n × (n-1) × ... × 1
0! = 1 by definition
Permutation
P(n,r) = n! / (n-r)!
Order matters
Combination
C(n,r) = n! / (r!(n-r)!)
Order doesn't matter
What is a Factorial?
A factorial, denoted by n!, is the product of all positive integers from 1 to n. Factorials are fundamental in mathematics, especially in combinatorics, probability, and calculus. The factorial function grows extremely rapidly, making it one of the fastest-growing common mathematical functions.
Definition:
- n! = n × (n-1) × (n-2) × ... × 3 × 2 × 1
- 0! = 1 (by definition)
- 1! = 1
- Factorials are only defined for non-negative integers
First Few Factorials:
| n | n! | Calculation |
|---|---|---|
| 0 | 1 | By definition |
| 1 | 1 | 1 |
| 2 | 2 | 2 × 1 |
| 3 | 6 | 3 × 2 × 1 |
| 4 | 24 | 4 × 3 × 2 × 1 |
| 5 | 120 | 5 × 4 × 3 × 2 × 1 |
| 10 | 3,628,800 | 10 × 9 × ... × 1 |
Factorial Formulas and Properties
Several important formulas and relationships involve factorials:
Key Factorial Formulas
Where:
- n!= n factorial
- P(n,r)= Permutations of n things taken r at a time
- C(n,r)= Combinations of n things taken r at a time
- n!!= Double factorial
Permutations and Combinations
Factorials are essential for counting arrangements and selections:
| Concept | Formula | Order Matters? | Example |
|---|---|---|---|
| Permutation | P(n,r) = n!/(n-r)! | Yes | Arrange 3 books from 5: P(5,3) = 60 |
| Combination | C(n,r) = n!/(r!(n-r)!) | No | Choose 3 from 5: C(5,3) = 10 |
| Full Permutation | n! | Yes | Arrange 5 books: 5! = 120 |
| With Repetition | n!/(n₁!×n₂!×...) | Yes | Arrange "MISSISSIPPI" |
Key Insight: Permutations = Combinations × (arrangements of selected items)
P(n,r) = C(n,r) × r!
How to Use This Factorial Calculator
Our factorial calculator computes factorials and related values quickly:
- Enter a Number: Input a non-negative integer (0 or positive whole number)
- Click Calculate: The calculator computes the factorial
- View Results:
- The factorial value n!
- Scientific notation for large results
- Number of digits in the result
- Step-by-step multiplication
Additional Features:
- Permutations calculator: P(n,r)
- Combinations calculator: C(n,r)
- Double factorial: n!!
- Subfactorial (derangements): !n
Important Notes:
- Factorials grow extremely fast - 20! has 19 digits
- Most calculators overflow around 170!
- For very large n, use Stirling's approximation
Special Types of Factorials
Beyond the basic factorial, there are several related functions:
Double Factorial (n!!):
- Product of every other integer from n down to 1 or 2
- Odd: 7!! = 7 × 5 × 3 × 1 = 105
- Even: 8!! = 8 × 6 × 4 × 2 = 384
- 0!! = 1!! = 1
Subfactorial (!n) or Derangements:
- Number of permutations where no element is in its original position
- !n = n! × Σ((-1)^k / k!) from k=0 to n
- Example: !4 = 9 (arrangements of ABCD where no letter is in its original spot)
Gamma Function Γ(n):
- Extension of factorial to non-integers
- Γ(n) = (n-1)! for positive integers
- Γ(1/2) = √π
- Allows "fractional factorials" like (0.5)!
Primorial (n#):
- Product of all primes ≤ n
- 7# = 2 × 3 × 5 × 7 = 210
Applications of Factorials
Factorials appear throughout mathematics and science:
Probability and Statistics:
- Calculating probabilities of arrangements
- Binomial coefficients in distributions
- Expected value calculations
Combinatorics:
- Counting permutations and combinations
- Binomial theorem: (a+b)ⁿ expansion
- Pascal's triangle entries
Calculus and Analysis:
- Taylor series expansions: e^x = Σ(x^n / n!)
- sin(x) = x - x³/3! + x⁵/5! - ...
- Maclaurin series coefficients
Computer Science:
- Algorithm complexity analysis
- Brute force search space sizing
- Cryptographic key space calculations
Real-World Examples:
- How many ways can 10 people line up? 10! = 3,628,800
- How many 5-card hands from 52 cards? C(52,5) = 2,598,960
- Probability of a specific ordering in a deck of 52 cards: 1/52!
Stirling's Approximation
For large values of n, Stirling's approximation provides a way to estimate factorials:
Stirling's Approximation
Where:
- n= The number to compute factorial of
- e= Euler's number ≈ 2.71828
- π= Pi ≈ 3.14159
Worked Examples
Calculate a Basic Factorial
Problem:
Calculate 7!
Solution Steps:
- 1Write out the multiplication: 7! = 7 × 6 × 5 × 4 × 3 × 2 × 1
- 2Multiply step by step: 7 × 6 = 42
- 342 × 5 = 210
- 4210 × 4 = 840
- 5840 × 3 = 2,520
- 62,520 × 2 = 5,040
- 75,040 × 1 = 5,040
Result:
7! = 5,040
Permutation Problem
Problem:
How many ways can 4 students be arranged in a line from a class of 10?
Solution Steps:
- 1This is a permutation problem: P(n,r) = n!/(n-r)!
- 2n = 10 (total students), r = 4 (positions)
- 3P(10,4) = 10!/(10-4)! = 10!/6!
- 4= (10 × 9 × 8 × 7 × 6!)/6!
- 5= 10 × 9 × 8 × 7
- 6= 5,040
Result:
P(10,4) = 5,040 ways
Combination Problem
Problem:
How many ways can a committee of 3 be chosen from 8 people?
Solution Steps:
- 1This is a combination problem (order doesn't matter)
- 2C(n,r) = n!/(r!(n-r)!)
- 3C(8,3) = 8!/(3! × 5!)
- 4= (8 × 7 × 6 × 5!)/(3! × 5!)
- 5= (8 × 7 × 6)/(3 × 2 × 1)
- 6= 336/6 = 56
Result:
C(8,3) = 56 committees
Tips & Best Practices
- ✓Remember: 0! = 1 by definition, not 0
- ✓Factorials grow extremely fast - 20! already has 19 digits
- ✓Use the recursive property: n! = n × (n-1)! to build up from smaller factorials
- ✓For permutations (order matters): P(n,r) = n!/(n-r)!
- ✓For combinations (order doesn't matter): C(n,r) = n!/(r!(n-r)!)
- ✓Stirling's approximation works well for large n: n! ≈ √(2πn)(n/e)^n
- ✓Cancel common factors before calculating to simplify: 10!/8! = 10 × 9 = 90
Frequently Asked Questions
Sources & References
Last updated: 2026-01-22