Books · The Fiddler: Solutions
Chapter 64
Can You Tip the Dominoes?
You place dominoes in a line one at a time. Each domino you place has a chance of tipping over, which knocks down every domino placed so far; then you start again. Over many rounds, what is the median number of dominoes placed (counting the one that triggers the cascade) at the moment a cascade happens?
The Fiddler, Zach Wissner-Gross, March 7, 2025(original post)
Solution
The number of dominoes placed up to and including the trigger is geometric: each placement independently triggers with probability , so . The median is the smallest with , i.e. so the median is (Check: and , so the cumulative probability first crosses at .)
The computation
Play the rounds rather than the formula: the dominoes placed before a trigger is exactly a geometric draw, so simulate millions of rounds and take the empirical median.
import numpy as np
rng = np.random.default_rng(0)
N = rng.geometric(0.01, 5_000_000) # placements up to and including the trigger
print(np.median(N)) # 69.0
Extra Credit
Replace by for a whole number , and let be the resulting median. What does approach as ?
Solution
The median is . For small , , so with , The ceiling washes out in the limit since grows like . (The official extra-credit value is paywalled; this is my own.)
The computation
For each , find the median straight from the distribution: binary-search the smallest whose survival drops to . The ratio marches to .
def median_geom(p):
hi = 1
while (1 - p)**hi > 0.5: hi *= 2 # bracket the crossing
lo = 1
while lo < hi:
mid = (lo + hi) // 2
if (1 - p)**mid <= 0.5: hi = mid
else: lo = mid + 1
return lo
for k in range(1, 8):
M = median_geom(10.0**-k)
print(k, M, round(M / 10**k, 4)) # -> 0.6931 = ln 2