Counting Without Listing
In short: C(n, r), "n choose r", counts how many r-item subsets an
n-item set has, without ever listing them. Two ways to compute it: Pascal's
triangle, where every cell is the sum of the two cells above it — the
first dynamic-programming table most people meet, often years before they'd
call it that — and the factorial formula n! / (r! · (n-r)!), which
needs a modular inverse to divide under a modulus, since there's no /
in modular arithmetic. Quarry's hash kernel uses both: Pascal's triangle to
explain where the numbers come from, and the factorial-and-inverse route to
compute C(n, r) mod p for huge n without building a triangle that big.

Splitting a bill among friends, the counting version
Eight friends split into a table of 3 and a table of 5 for a trip's two
cars. How many different groups of 3 could go in the first car? That's
C(8, 3) — order inside the car doesn't matter, only who's in it.
This works for small n, but num is a product of r numbers close to
n — for n in the millions, num becomes an enormous integer before
the division ever happens. That's fine in Python's big-int arithmetic, but
slow, and it's exactly the kind of growth Quarry's hash kernel needs to
avoid when counting collisions over billions of keys.