Chapter 228
One Small Step For Man, One Giant Coin Flip For Mankind
Riddler Express
A soccer coach builds a team of players from an infinite pool. Each player’s jersey wears a unique positive integer; that integer is the average number of games it takes that player to score a goal. The coach wants his team to average exactly two goals per game and wants his weakest player to be as strong as possible. What number does the ideal weakest player wear? What numbers are on the other ten?
The Riddler, FiveThirtyEight, May 24, 2019(original post)
Solution
A player numbered scores goals per game on average. The team’s goals per game is therefore the sum of reciprocals of eleven distinct positive integers, which must equal . Making the weakest player as strong as possible means minimising the largest integer on the team.
The problem is the Egyptian-fraction representation of as a sum of eleven distinct unit fractions, with the largest denominator minimised.
Setup and search. Let be the largest integer on the team. The reciprocals have size- subsets to scan; we look for the smallest that admits a subset summing to exactly . An exhaustive search from upward gives the smallest such :
No valid team for . A direct enumeration of all subsets for finds none whose reciprocals sum to exactly .
Unique team for . The first solvable case has , and the subset is Verifying: A common-denominator check at confirms the sum is .
The numerical coincidence that has no slick proof I know; it is one of those facts about Egyptian fractions that drop out of search.
The computation
Brute-force every size- subset of in rational arithmetic, sweeping from upward; the first with a solution is the answer, and the subset itself is the team.
For each from upward, iterate over all subsets.
Compute the exact sum of reciprocals using
Fractionarithmetic.Stop at the first with a valid solution and print all solutions at that .
from fractions import Fraction
from itertools import combinations
target = Fraction(2)
for M in range(11, 30):
found = []
for combo in combinations(range(1, M + 1), 11):
if sum(Fraction(1, n) for n in combo) == target:
found.append(combo)
if found:
print(f"smallest M = {M}: {len(found)} solution(s)")
for s in found:
print(" ", s)
break
The script prints the unique team realising the boxed answer.
Riddler Classic
Three astronauts will land on Mars and want to pick which of them takes the first step by a fair and efficient method. Can they make the choice using a fixed number of flips of an unfair coin? They may set the coin’s probability of heads to any number between and , may choose any fixed number of flips, and may assign any combination of outcomes to each astronaut. Extra credit: five astronauts.
The Riddler, FiveThirtyEight, May 24, 2019(original post)
Solution
Yes, it is possible. The trick is to lean on the symmetry between heads and tails so that two of the three astronauts have identically distributed outcomes by construction; that leaves one continuous parameter, the coin’s heads probability , and one continuous equation to solve.
The construction. Use flips and assign outcomes by their number of heads. There is outcome with heads (HHHH), outcomes with heads (HHHT and its three rotations), with heads, with head, and with heads, totalling outcomes. Write this pattern as .
Assign Astronaut A the outcomes , i.e., pattern . Assign Astronauts B and C identically: each gets pattern , splitting the remaining outcomes symmetrically by number of heads. The full assignment uses every outcome exactly once.
By construction B and C have the same probability of winning, whatever is, because their outcome-sets are heads-tails mirrors of each other. So we only need to find with
Solving for . The function is convex in on with value at the endpoints, minimum at . It crosses at two symmetric values and . Setting expands to a quartic; one closed form is At this Astronaut A wins with probability , and B and C each win with probability by symmetry.
Why fewer flips will not work. With flip there are only outcomes; no partition into three non-empty groups exists. With flips, outcome weights are , total . Their pairwise sums must give three equal thirds: or rearrangements. The system is overdetermined and admits no solution with . With flips, the symmetric-split construction requires to take HHH and TTT, leaving outcomes for B and C; the resulting equation has no solution in since on with minimum at .
Extra credit: five astronauts. The same symmetry trick scales. With flips and , Zach Wissner-Gross’s construction divides the outcomes into five sets, each summing to . The full assignment is intricate (see the official) but the existence is guaranteed by the same continuity-and-symmetry argument: we have enough free outcome groupings at , and one continuous parameter , to satisfy the four independent equations via symmetry reductions.
The computation
Re-encode the problem at : enumerate all outcomes by number of heads, compute the probability each astronaut wins under the published assignment as a function of , and verify that makes all three equal to . A direct Monte Carlo at that must also produce three counts each close to of the trials.
Build the -element “number-of-heads” distribution .
Compute Astronaut A’s win probability as the plus entries.
Solve numerically by bisection.
Monte-Carlo the four-flip experiment at the solved over trials.
import random
from math import comb
def PA(p):
return p ** 4 + (1 - p) ** 4
# Bisect on (0, 1/2) for the lower root.
lo, hi = 0.0, 0.5
for _ in range(80):
mid = (lo + hi) / 2
if PA(mid) > 1 / 3:
lo = mid
else:
hi = mid
p_star = (lo + hi) / 2
print(f"p* = {p_star:.6f}, P_A(p*) = {PA(p_star):.6f}")
# Verify all three astronauts get exactly 1/3 at p*.
P_total = sum(comb(4, k) * p_star ** k * (1 - p_star) ** (4 - k)
for k in range(5))
print(f"sum of all 16 outcomes' probs = {P_total:.6f}")
# Outcome counts B and C should match, equal to (1 - PA)/2.
PB = (1 - PA(p_star)) / 2
print(f"P_A = {PA(p_star):.6f}, P_B = P_C = {PB:.6f}")
# Build the canonical [0, 2, 3, 2, 0] / [0, 2, 3, 2, 0] split: B and C
# each get 2 outcomes with k=1, 3 with k=2, 2 with k=3. The lex-smallest
# half of each k-stratum goes to B, the rest to C.
from itertools import combinations
B_set, C_set = set(), set()
need = {1: 2, 2: 3, 3: 2}
for k in (1, 2, 3):
outcomes = sorted(combinations(range(4), k)) # bit positions of heads
for i, bits in enumerate(outcomes):
out = tuple(1 if j in bits else 0 for j in range(4))
(B_set if i < need[k] else C_set).add(out)
print(f"|B|={len(B_set)} |C|={len(C_set)}")
PB_exact = sum(p_star ** sum(o) * (1 - p_star) ** (4 - sum(o)) for o in B_set)
PC_exact = sum(p_star ** sum(o) * (1 - p_star) ** (4 - sum(o)) for o in C_set)
print(f"P_A = {PA(p_star):.6f}, P_B = {PB_exact:.6f}, P_C = {PC_exact:.6f}")
random.seed(2019)
trials = 1_000_000
def flip4():
return tuple(1 if random.random() < p_star else 0 for _ in range(4))
def winner(out):
k = sum(out)
if k == 4 or k == 0:
return "A"
return "B" if out in B_set else "C"
counts = {"A": 0, "B": 0, "C": 0}
for _ in range(trials):
counts[winner(flip4())] += 1
for kk, v in counts.items():
print(f" {kk}: {v/trials:.4f}")
The script prints , to the displayed precision, and within to six decimals, and Monte Carlo counts within of on each astronaut.
The split here gives each of B and C the head-count pattern across the five number-of-heads buckets; their win probabilities are equal as polynomials in , by direct expansion. Note that and will not in general be equal for splits with different head-count patterns, even though the splits use heads-tails complements.