Chapter 65
Are You Clever Enough?
Riddler Express
You are somewhere in the top percent of a huge population, uniformly likely to be anywhere in that decile. You enter a room with nine other randomly chosen people. What is the probability you are the cleverest in the room?
Solution
Scale cleverness to be uniform on . Each of the nine others is then a uniform draw on , while you are uniform on . You are cleverest exactly when all nine others fall below your value . For a fixed , the chance that all nine independent draws are below is , so averaging over your own position, Being top-decile is a real edge but not a lock: roughly a third of the time one of the nine outshines you.
The computation
Draw your cleverness and the nine others many times and count how often you top the room.
import numpy as np
rng = np.random.default_rng(0)
def prob_cleverest(n=9, lo=0.9, hi=1.0, runs=5_000_000):
others = rng.random((runs, n))
you = rng.uniform(lo, hi, runs)
return np.mean(others.max(axis=1) < you)
print(prob_cleverest()) # ~0.6513
Riddler Classic
Roll four dice; freeze at least one, reroll the rest; repeat until all are frozen. Playing to maximise the expected sum, what score do you average? Extra credit: with five, six, or dice?
Solution
Solve it by building up from fewer dice. Write for the best expected total starting with dice. Faced with a particular roll of dice, you will keep the highest values and reroll the lowest; if you choose to reroll of them, you bank the top dice now and play on optimally with fresh dice, worth in expectation. So the value of a sorted roll is and averaging this over all equally likely rolls gives , anchored by . Working up from one die, The extra dice keep adding a little under each: and .
The computation
Build the table in order: for each , enumerate every roll, take the best freeze-and-reroll choice, and average exactly with fractions.
from itertools import product
from fractions import Fraction as F
def ems_table(maxn):
ems = {0: F(0)}
for n in range(1, maxn + 1):
total = F(0)
for roll in product(range(1, 7), repeat=n):
s = sorted(roll, reverse=True)
total += max(sum(s[:n - j]) + ems[j] for j in range(n))
ems[n] = total / 6**n
return ems
t = ems_table(6)
for n in range(1, 7): print(n, t[n]) # EMS(4) = 989065/52488