Skip to content
Vamshi Jandhyala

Books · The Riddler

Chapter 58

Can You Survive Squid Game?

Riddler Express

A spherical pumpkin has the same numerical value for its volume (in cubic inches) and its surface area (in square inches). What is its radius? Extra credit: for an nn-dimensional ball, when do the numerical volume and surface “area” agree, and what is the radius then?

Solution

Set the two numbers equal. For the sphere, 43πr3=4πr2    r=3.\frac{4}{3}\pi r^3 = 4\pi r^2 \;\Longrightarrow\; r = \boxed{3}. The general case falls out of one fact: the surface of an nn-ball is the derivative of its volume with respect to the radius, and the volume scales as rnr^n, so An(r)=ddrVn(r)=nrVn(r).A_n(r) = \frac{d}{dr}V_n(r) = \frac{n}{r}\,V_n(r). Setting An(r)=Vn(r)A_n(r) = V_n(r) gives nr=1\tfrac{n}{r} = 1, that is r=n.r = \boxed{n}. The sphere (n=3n = 3) is just the case r=3r = 3, and a circle (n=2n = 2) matches at r=2r = 2.

The computation

Form the nn-ball volume from the standard formula, differentiate to get the surface, and solve volume == surface symbolically.

import sympy as sp
r, n = sp.symbols('r n', positive=True)
V = sp.pi**(n/2) / sp.gamma(n/2 + 1) * r**n          # n-ball volume
A = sp.diff(V, r)                                      # surface = dV/dr
print(sp.solve(sp.Eq(V, A), r))                       # [n]
print(sp.solve(sp.Eq(V.subs(n, 3), A.subs(n, 3)), r)) # [3]

Riddler Classic

Sixteen competitors must cross a bridge of 1818 pairs of glass squares. In each pair one square is tempered (safe) and one is normal (breaks); nobody knows which. A competitor stepping onto an unrevealed pair guesses, and a wrong guess eliminates them but reveals that pair to everyone behind. On average, how many of the 1616 survive?

Solution

Each pair is revealed exactly once, by whoever first steps on it, and that first step is a fair coin: tails (probability 12\tfrac12) eliminates the guesser, heads lets them carry on. Once a pair is known, everyone behind walks it safely. So if competitors never ran out, the number eliminated would be the number of “tails” among 1818 independent flips, a Binomial(18,12)\text{Binomial}(18, \tfrac12) with mean 99. The only complication is that you cannot lose more than 1616 people, so survivors are E[survivors]=E[max(16B, 0)],BBinomial(18,12).\mathbb{E}[\text{survivors}] = \mathbb{E}\big[\max(16 - B,\ 0)\big], \qquad B \sim \text{Binomial}(18, \tfrac12). The cap almost never binds (needing 1616 tails out of 1818), so the answer is a hair above 169=716 - 9 = 7: 458757655367.0001.\frac{458757}{65536} \approx \boxed{7.0001}.

The computation

Solve the survivor recurrence exactly: with nn competitors and mm pairs left, the next pair is safe or fatal with equal chance, S(n,m)=12S(n,m1)+12S(n1,m1)S(n,m) = \tfrac12 S(n, m-1) + \tfrac12 S(n-1, m-1).

from fractions import Fraction as F
from functools import lru_cache
@lru_cache(None)
def S(n, m):
    if n == 0: return F(0)
    if m == 0: return F(n)
    return (S(n, m - 1) + S(n - 1, m - 1)) / 2
print(S(16, 18), float(S(16, 18)))            # 458757/65536, 7.0001