Chapter 285
Beware The Hot Pumpkin
The Riddler for October 30, 2020. The Express is a goat-grazing area problem dressed as an election-official’s string, and the Classic is a Josephus-style elimination game whose clues pin down a single counting number by the Chinese remainder theorem.
Riddler Express
A polling site is a square building, feet on each side. A string feet long is tied to a door at the middle of one side; you hold the free end. The string cannot pass through the building. What is the area of the region outside the building you can reach?
The Riddler, FiveThirtyEight, October 30, 2020(original post)
Solution
In front of the door’s wall the string sweeps freely: a semicircle of radius , area . The door sits feet from each corner of that wall. To reach past a corner you lay feet of string along the wall, leaving feet to swing around the corner, a quarter-circle of radius on each adjacent side. The two quarter-circles together make a semicircle of radius , area . (Fifty feet does not reach the far corners, so the string never wraps a second time.) The total is This is a “goat grazing” problem: the building’s corners snag the tether, replacing the would-be full circle () with the smaller wrapped region.
The computation
Encode the three pieces (front semicircle plus two corner quarter-circles) and sum.
import math
front = 0.5 * math.pi * 100**2 # semicircle, radius 100
corners = 2 * 0.25 * math.pi * 50**2 # two quarter-circles, radius 50
total = front + corners
print(round(total / math.pi, 6), round(total)) # 6250.0 (=6250*pi) 19635
The reachable area is square feet.
Riddler Classic
You and friends ( players) sit in a circle and fix a positive integer . Starting with you counting “1” and passing left, the player who says “” is eliminated; the next player restarts the count at , and so on until one remains. The first eliminated player is seats to your left; the second is seats to the left of the next starter; the third starter is eliminated immediately (counts up to landing back on himself). What is the smallest consistent with this?
The Riddler, FiveThirtyEight, October 30, 2020(original post)
Solution
Each round, the count wraps the circle some whole number of times and then stops on the eliminated player. Counting includes the starter, so reaching the player seats to the starter’s left means people have counted off (the starter plus others).
Round 1, players, eliminated seats left: .
Round 2, players, eliminated seats left: .
Round 3, players, the starter eliminates himself: .
The moduli are pairwise coprime, so the Chinese remainder theorem gives a unique modulo . Solving the system yields
The computation
Encode the three congruences and solve them by the Chinese remainder theorem.
from sympy.ntheory.modular import crt
moduli = [61, 60, 59]
residues = [19, 32, 1]
N, M = crt(moduli, residues)
print(int(N), int(M)) # 136232 215940
# brute-force check
print(min(n for n in range(1, 215941)
if n % 61 == 19 and n % 60 == 32 and n % 59 == 1)) # 136232
The smallest consistent count is .