Chapter 62
Can You Get The Paper Cut?
Riddler Express
A crystal is a polyhedron with exactly six edges, at least four of which are inch long. Among all such crystals, the key is the one of largest volume. What is that volume?
Solution
Six edges force the shape to be a tetrahedron. To make it as large as possible while keeping four unit edges, take three of them as a face: an equilateral triangle of side , area . The fourth unit edge is one of the three edges rising to the apex; the volume is so we want the height as large as possible. The apex is one unit edge away from a base vertex, and its height above the base is largest, equal to , exactly when that unit edge stands vertical. Then The two remaining edges (from the apex to the other two base vertices) come out to , longer than , so exactly four edges are unit length, as allowed.
The computation
Search all ways to fix four edges at and leave two free, computing each tetrahedron’s volume from the Cayley–Menger determinant, and maximise.
import numpy as np
from itertools import combinations
from scipy.optimize import minimize
edges = [frozenset(e) for e in combinations(range(4), 2)] # 6 edges
def vol(d):
M = np.ones((5, 5)); M[0, 0] = 0
for i in range(4):
for j in range(4):
M[i + 1, j + 1] = 0 if i == j else d[frozenset((i, j))]**2
return np.sqrt(max(np.linalg.det(M) / 288, 0))
best = 0
for free in combinations(range(6), 2):
f = lambda p: -vol({**{e: 1.0 for e in edges},
edges[free[0]]: p[0], edges[free[1]]: p[1]})
for x0 in [(1.4, 1.4), (0.8, 1.5)]:
best = max(best, -minimize(f, x0, bounds=[(.01, 1.99)]*2).fun)
print(best, np.sqrt(3) / 12) # 0.14434, 0.14434
Riddler Classic
A child cuts -inch-wide strips from a sheet of paper: she picks one of the four sides at random and trims a strip parallel to it, repeating until the sheet’s shorter side is at most inch (so the whole thing is a strip). Starting from inches, how many cuts does she make on average? Extra credit: starting from ?
Solution
Each cut shrinks one of the two dimensions by inch, and the two sides parallel to a given dimension make it equally likely to trim either way, so every cut is a fair coin: shrink the long side or the short side. The sheet becomes a strip once a dimension first falls to inch or below. The -inch side reaches that after cuts (); the -inch side reaches it after cuts (). So the process is just fair coin flips, stopping when we accumulate “long” cuts or “short” cuts, and we want the expected number of flips.
Writing for the expected cuts still needed when long-cuts and short-cuts remain, each flip uses one or the other, Unrolling from gives the exact value In general the two targets are and cuts; for a square sheet the race is symmetric and the answer is a touch below the smaller target.
The computation
Solve the recurrence exactly with memoised fractions.
from fractions import Fraction as F
from functools import lru_cache
@lru_cache(None)
def C(a, b):
if a == 0 or b == 0: return F(0)
return 1 + (C(a - 1, b) + C(a, b - 1)) / 2
print(C(10, 8), float(C(10, 8))) # 234137/16384, 14.29