Chapter 47
Can You Reach The Summit First?
Riddler Express
Each week, between one and five people show up from each of three towns (Blacksburg, Greensboro, Silver Spring), every count equally likely. They want two equal teams with two towns against the third. What is the probability this is possible? Extra credit: between one and per town?
Solution
Two equal teams with two towns against the third means one town’s headcount equals the sum of the other two: , or , or . With each count uniform on there are equally likely triples. The equation has solutions for each , so of them; the three equations are mutually exclusive (any two would force a town to have zero people), so For this is .
The computation
Count the triples that satisfy one of the three balance equations.
from itertools import product
from fractions import Fraction as F
N = 5
good = sum(b+g == s or b+s == g or g+s == b
for b, g, s in product(range(1, N+1), repeat=3))
print(F(good, N**3)) # 6/25
Riddler Classic
You race three others up a mountain; the summit awards points for first through fourth. All four are equally fast, but two of your rivals are teammates: the slower teammate is pulled up to the faster one’s time, so they finish together. How many points can you expect?
Solution
Call yourself , the lone rival , and the teammates . The teammates cross at the faster one’s time, so in the finishing order the two s collapse onto the earlier of their two positions. The catch: if you finish between the two teammates, the trailing teammate is dragged up past you, so both teammates end ahead of you.
The four riders fall into equally likely order patterns of . Scoring each by your resulting place (with the collapse applied) and averaging gives A lone rider with no teammates in the field would average , so the rival partnership quietly costs you about a third of a point.
The computation
Enumerate the twelve finish-order patterns; for each, work out your place after the trailing teammate is pulled up to the leading one, and average the points.
from itertools import permutations
from fractions import Fraction as F
total = F(0); n = 0
for p in set(permutations('ABCC')):
a = p.index('A'); c1, c2 = [i for i, x in enumerate(p) if x == 'C']
n += 1
if a == 0: total += 5 # you are first
elif a == 3: total += 1 # you are last
elif c1 < a < c2: total += 2 if a == 1 else 1 # between teammates
else: total += 3 if a == 1 else 2
print(total / n) # 29/12