Factorial Calculator
Calculate factorial n!, permutations P(n,r), and combinations C(n,r) with step-by-step working.
Returns exact values up to 20! for probability problems.
Factorial is one of the most fundamental operations in combinatorics, probability, and discrete mathematics. It represents the number of ways to arrange a set of distinct objects.
Factorial definition:
n! = n × (n−1) × (n−2) × ... × 2 × 1
0! = 1 (by convention — there is exactly one way to arrange zero objects)
Worked examples:
- 5! = 5 × 4 × 3 × 2 × 1 = 120
- 10! = 3,628,800
- 20! = 2,432,902,008,176,640,000
Permutations — ordered arrangements:
P(n, r) = n! / (n − r)!
How many ways can you arrange 3 books chosen from a shelf of 7? P(7, 3) = 7! / 4! = 5,040 / 24 = 210 arrangements
Combinations — unordered selections:
C(n, r) = n! / (r! × (n − r)!)
How many ways can you choose 3 students from a class of 20? C(20, 3) = 20! / (3! × 17!) = 6,840 / 6 = 1,140 combinations
Stirling’s approximation (for very large n):
n! ≈ √(2πn) × (n/e)^n
Useful when n > 20 and exact computation is impractical.
Real-world applications:
- Cryptography: Key space sizes (e.g., 256! possible deck shuffles)
- Probability: Calculating exact probabilities in card games and lotteries
- Statistics: Binomial distribution coefficients
- Computer science: Algorithm complexity analysis (e.g., O(n!) brute-force)
- Scheduling: Number of possible task orderings
Growth rate: Factorial grows faster than exponential. 20! has 19 digits; 100! has 158 digits.