Chapter 34
Who Wants To Be A Riddler Millionaire?
Riddler Express
On the $1 million question with choices , you are sure the answer is , with the other three equally plausible. You use the , which removes two wrong answers and always keeps the correct one. survives. How confident are you now that is correct?
Solution
Let be the event that is one of the two answers the leaves. The lifeline always keeps the correct answer and one of the three wrong answers at random. If is correct (prior ) it certainly survives, so . If is wrong (prior ), it survives only as the lone wrong answer kept, one of three, so . By Bayes, Seeing survive nudges your confidence from up to , because a wrong would often have been removed.
The computation
Simulate the lifeline: place the correct answer ( with probability , else one of the others), keep it plus a random wrong answer, and among the trials where survives, measure how often was right.
import numpy as np
rng = np.random.default_rng(0); runs = 4_000_000
survived = correct = 0
for _ in range(runs):
truth = 'B' if rng.random() < 0.7 else rng.choice(['A', 'C', 'D'])
wrong = [c for c in 'ABCD' if c != truth]
kept = {truth, rng.choice(wrong)} # 50:50 keeps truth + one wrong
if 'B' in kept:
survived += 1; correct += (truth == 'B')
print(correct / survived) # ~0.875
Riddler Classic
The classic birthday problem needs only 23 people for better-than-even odds that two share a birthday. How many people do you need for better-than-even odds that at least three share a birthday? (Ignore leap years.)
Solution
Work with the complement: no birthday is shared by three or more people, meaning every day is used at most twice. Among people, the number of birthday assignments with no day used three or more times, divided by , gives . There is no tidy closed form, but the count is built up day by day: process the days one at a time, and for each decide whether , , or of the remaining people land on it, in ways.
Running this for growing , the probability of at least three sharing first passes one half at So people suffice, well above the of the two-person version, since coincidences of three are much rarer.
The computation
For each , count the assignments with every day used at most twice (a dynamic program over the days), divide by for the no-triple probability, and report the first whose complement exceeds one half.
from fractions import Fraction as F
from math import comb
def no_triple(n, D=365):
dp = [0] * (n + 1); dp[0] = 1 # dp[k]: ways for k people
for _ in range(D): # add one day at a time
nd = [0] * (n + 1)
for k in range(n + 1):
if dp[k]:
for j in (0, 1, 2): # 0, 1 or 2 people on this day
if k + j <= n:
nd[k + j] += dp[k] * comb(n - k, j)
dp = nd
return F(dp[n], D**n)
n = 80
while 1 - no_triple(n) <= F(1, 2):
n += 1
print(n) # 88