Combinatorics Workbench

base counting models with story-based presets

Loading interactive simulation...

Model classifier for counting problems 🖖

The hard part of combinatorics is rarely the arithmetic — it's classifying the story problem correctly. Two yes/no questions do almost all the work: does order matter (arranging vs. choosing), and can the same item be picked more than once (with or without repetition)? Those two answers alone sort every problem into one of four basic models — permutations, combinations, permutations with repetition, and combinations with repetition ('stars and bars') — which is why a committee, a lineup, a PIN code, and a lottery ticket each need a different formula despite looking superficially similar. Inclusion-exclusion and derangements exist precisely because real problems often break the clean assumptions of those four models, overlapping sets or forbidding exact matches in ways the basic formulas can't handle alone.

Counting without listing 🖖

The point of combinatorics is to find how many arrangements exist without writing them all out. A 4-digit PIN has only 10⁴ = 10,000 possibilities you could still picture as a list, but a 6-from-49 lottery ticket has C(49,6) = 13,983,816 — nobody counts those by hand. The formulas here return the exact total in a single step, turning a hopeless enumeration into a short calculation. That is why the tool always shows the count, its digit length, and a scientific-notation form for the truly enormous ones.

Secret Santa hides the number e 🖖

The derangement model counts arrangements where nothing sits in its own place — the Secret Santa case where no one draws their own name. Remarkably, the fraction of all shuffles that are derangements converges to 1/e ≈ 0.3679 almost at once: by just 6 people it is already correct to three decimals. So the chance a random Secret Santa leaves everybody without their own name is about 37%, and it barely moves whether the group has 6 members or 600. The constant e, born in calculus and compound interest, drops straight out of a pure counting problem.

Example problems