Stirling's Approximation in Puzzles
A formula that approximates the fast-growing factorial function using elementary terms, giving interview candidates a quick way to estimate huge combinatorial quantities by hand.
Computing something like "how many ways can you shuffle 52 cards" or estimating a binomial coefficient with large numbers means dealing with factorials, which grow so fast that exact computation by hand is impractical and even a calculator's output is hard to interpret intuitively. Stirling's approximation gives a simple estimate: , which becomes very accurate as gets large. In plain terms, a factorial's size is dominated by raised to roughly its own power divided by , with a modest correction factor out front.
In an interview setting, candidates rarely need the full formula — the key trick is the simplified log version: . This lets you estimate things like the order of magnitude of mentally: , so , an astronomically large number confirmed to be roughly correct order-of-magnitude without ever multiplying 100 numbers together. This kind of quick estimation is exactly what interviewers probing for numerical intuition are testing.
Stirling's approximation, , or its simpler log form , lets you estimate the size of huge factorials or combinatorial counts by hand instead of needing exact multiplication.
Related concepts
Practice in interviews
Further reading
- Feller, An Introduction to Probability Theory, vol. 1, ch. 2