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 -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, The general case falls out of one fact: the surface of an -ball is the derivative of its volume with respect to the radius, and the volume scales as , so Setting gives , that is The sphere () is just the case , and a circle () matches at .
The computation
Form the -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 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 survive?
Solution
Each pair is revealed exactly once, by whoever first steps on it, and that first step is a fair coin: tails (probability ) 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 independent flips, a with mean . The only complication is that you cannot lose more than people, so survivors are The cap almost never binds (needing tails out of ), so the answer is a hair above :
The computation
Solve the survivor recurrence exactly: with competitors and pairs left, the next pair is safe or fatal with equal chance, .
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