Skip to content
Vamshi Jandhyala

Books · The Riddler

Chapter 65

Are You Clever Enough?

Riddler Express

You are somewhere in the top 1010 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 [0,1][0,1]. Each of the nine others is then a uniform draw on [0,1][0,1], while you are uniform on [0.9,1][0.9, 1]. You are cleverest exactly when all nine others fall below your value YY. For a fixed yy, the chance that all nine independent draws are below yy is y9y^9, so averaging over your own position, Pr(cleverest)=10.10.91y9dy=10.9100.6513.\Pr(\text{cleverest}) = \frac{1}{0.1}\int_{0.9}^{1} y^9 \,dy = 1 - 0.9^{10} \approx \boxed{0.6513}. 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 NN dice?

Solution

Solve it by building up from fewer dice. Write EMS(N)\mathrm{EMS}(N) for the best expected total starting with NN dice. Faced with a particular roll of NN dice, you will keep the highest values and reroll the lowest; if you choose to reroll jj of them, you bank the top NjN - j dice now and play on optimally with jj fresh dice, worth EMS(j)\mathrm{EMS}(j) in expectation. So the value of a sorted roll d(1)d(N)d_{(1)} \ge \cdots \ge d_{(N)} is max0jN1(d(1)++d(Nj)+EMS(j)),\max_{0 \le j \le N-1}\Big(\,d_{(1)} + \cdots + d_{(N-j)} + \mathrm{EMS}(j)\Big), and averaging this over all 6N6^N equally likely rolls gives EMS(N)\mathrm{EMS}(N), anchored by EMS(0)=0\mathrm{EMS}(0) = 0. Working up from one die, EMS(1)=72,EMS(2)=59372,EMS(3)=13049972,\mathrm{EMS}(1) = \tfrac72,\quad \mathrm{EMS}(2) = \tfrac{593}{72},\quad \mathrm{EMS}(3) = \tfrac{13049}{972}, EMS(4)=9890655248818.84.\mathrm{EMS}(4) = \frac{989065}{52488} \approx \boxed{18.84}. The extra dice keep adding a little under 66 each: EMS(5)24.44\mathrm{EMS}(5) \approx 24.44 and EMS(6)30.15\mathrm{EMS}(6) \approx 30.15.

The computation

Build the table EMS(0),EMS(1),\mathrm{EMS}(0), \mathrm{EMS}(1), \dots in order: for each NN, 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