Factorial, Gamma Function & Stirling Calculator
Calculate exact factorials, Stirling approximations for large numbers, and digital roots. Essential for permutations, probability, and combinatorics.
As an Amazon Associate and CJ Affiliate publisher we earn from qualifying purchases. Prices and availability may vary.
Factorial Guide
What do I need to know about Factorials and Counting?
n! = n × (n−1) × (n−2) × ... × 2 × 1. 0! = 1 (by convention — one way to arrange nothing). Key values: 5! = 120. 10! = 3,628,800. 20! = 2.43×10¹⁸. 52! = 8.07×10⁶⁷ (more than atoms in the observable universe). Factorials grow faster than any polynomial or exponential function. Stirling's approximation (accurate for large n): n! ≈ √(2πn) × (n/e)ⁿ. For n=10: exact = 3,628,800. Stirling: √(62.83) × (10/2.718)¹⁰ = 7.926 × 3,598,696 ≈ 3,598,600. Error: 0.83%.
What should I know about Double Factorial?
Double factorial n!! = n × (n−2) × (n−4) × ... down to 1 or 2. For even n: n!! = n × (n−2) × ... × 4 × 2. For odd n: n!! = n × (n−2) × ... × 3 × 1. Examples: 6!! = 6 × 4 × 2 = 48. 7!! = 7 × 5 × 3 × 1 = 105. Note: n!! ≠ (n!)! — it does NOT mean the factorial of factorial n. Wallis product: relates double factorials to π: π/2 = (2·4·6·8·...)/( 1·3·5·7·...) = (2·2·4·4·6·6·...)/(1·3·3·5·5·7·...) Double factorials appear in probability distributions and integration of trigonometric functions.
What's the key thing to understand about Subfactorials and Derangements?
A derangement is a permutation where NO element appears in its original position. !n = n! × Σ(k=0 to n) (-1)^k/k! ≈ n!/e. !0 = 1, !1 = 0, !2 = 1, !3 = 2, !4 = 9, !5 = 44. Classic problem: 'hat check' problem. n people each check in a hat. Hats are randomly returned. Probability no one gets their own hat: !n/n! → 1/e ≈ 0.3679. Remarkably, for n ≥ 5, the probability approaches 1/e regardless of n — approximately 36.79% of random shuffles are complete derangements.
What should I know about Applications of Large Factorials?
Card shuffling: 52! different orderings of a deck. If you could check one trillion orderings per second since the Big Bang (13.8 billion years), you would have checked approximately 4.36×10²⁹ orderings — a tiny fraction of 52! ≈ 8×10⁶⁷. Every properly shuffled deck has almost certainly never existed before. Password spaces: an 8-character password from 62 characters: 62⁸ ≈ 2×10¹⁴. An 8-character ALL DIFFERENT character password: P(62,8) = 62!/(62-8)! ≈ 1.36×10¹⁴. Genetics: the number of possible orderings of genes along a chromosome, or the number of ways alleles can combine, both rely on factorial-based combinatorics to calculate.