Combinatorics Workbench
base counting models with story-based presets
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
- committee choose - Choose 3 people from 10: order does not matter
- 5-card hand - 5-card hand
- lottery pick - lottery pick
- podium order - Top-3 podium from 10: order matters
- distinct password - distinct password
- arrange all - arrange all
- pin code - 4-digit PIN: repetition allowed
- product code - product code
- ice-cream scoops - 3 scoops from 8 flavors: order ignored, repeats allowed
- identical balls - identical balls
- BALLOON - Arrangements of BALLOON with repeated letters
- MISSISSIPPI - MISSISSIPPI
- distinct to bins (any) - distinct to bins (any)
- distinct to bins (onto) - Assign 6 distinct tasks to 3 workers, everyone gets at least one
- identical to bins (any) - identical to bins (any)
- identical to bins (non-empty) - identical to bins (non-empty)
- at least one Ace - 5-card hand with at least one Ace via complement counting
- three-set union - three-set union
- round table - Seat 7 around a round table: rotations are equivalent
- secret santa - Secret Santa count: no one draws their own name
- grid path - Grid shortest paths while avoiding one blocked cell