Library · The Riddler · Chapter 69

Can You Solve This Astronomical Enigma?

Revised Report an error

Riddler Express

Two cicada broods with periods AA and BB years have just emerged together. They interfere whenever one brood emerges exactly one year after the other (a multiple of AA and a multiple of BB differing by 11). With AA and BB coprime and both at most 2020, what is the longest a pair can go before its first interference?

Solution

Interference first happens in the earliest year max⁡(aA,bB)\max(aA, bB) for which a multiple of AA and a multiple of BB are one year apart, ∣aA−bB∣=1|aA - bB| = 1. Because AA and BB are coprime, such multiples always exist, and we want the pair that pushes this first collision as late as possible. Scanning all coprime pairs up to 2020, the winner is A=17A = 17, B=19B = 19: 17×9=153,19×8=152,∣153−152∣=1,17 \times 9 = 153, \qquad 19 \times 8 = 152, \qquad |153 - 152| = 1, so the first interference is in year 153.\boxed{153.} The two largest coprime periods available are also nearly equal, which forces their multiples to take the longest to drift to within a single year of each other.

The computation

For each coprime pair, find the earliest year where a multiple of AA sits one off a multiple of BB, and take the largest such year.

from math import gcd
def first_interference(a, b):
    return min(max(x, y) for x in range(0, a*b + 1, a)
               for y in range(0, a*b + 1, b) if abs(x - y) == 1)
pairs = [(a, b) for a in range(1, 20) for b in range(a, 21) if gcd(a, b) == 1]
print(max((first_interference(a, b), a, b) for a, b in pairs))  # (153, 17, 19)

Riddler Classic

Three planets orbit a star in circles: planet AA at radius 33 with period 33 years, BB at radius 44 with period 44, CC at radius 55 with period 55. They are collinear right now. When are the three planets next collinear (the star need not be on the line)?

Solution

Planet ii sits at (ricos⁡ωit, risin⁡ωit)\big(r_i\cos\omega_i t,\ r_i\sin\omega_i t\big) with ωi=2π/Ti\omega_i = 2\pi/T_i. Three points are collinear exactly when the signed area of their triangle vanishes, that is when ∣r1cos⁡ω1tr1sin⁡ω1t1r2cos⁡ω2tr2sin⁡ω2t1r3cos⁡ω3tr3sin⁡ω3t1∣=0.\begin{vmatrix} r_1\cos\omega_1 t & r_1\sin\omega_1 t & 1\\ r_2\cos\omega_2 t & r_2\sin\omega_2 t & 1\\ r_3\cos\omega_3 t & r_3\sin\omega_3 t & 1 \end{vmatrix} = 0. With (r,ω)=(3,2π3),(4,π2),(5,2π5)(r,\omega) = (3, \tfrac{2\pi}{3}), (4, \tfrac{\pi}{2}), (5, \tfrac{2\pi}{5}) this expands to 15sin⁡4πt15−12sin⁡πt6−20sin⁡πt10=0.15\sin\frac{4\pi t}{15} - 12\sin\frac{\pi t}{6} - 20\sin\frac{\pi t}{10} = 0. At t=0t = 0 all three sit on the same axis, so that is one solution; the next positive root is t≈7.77 years.t \approx \boxed{7.77 \text{ years.}}

The computation

Track the three planets’ actual positions and scan for the first time after t=0t = 0 when the signed area of their triangle changes sign.

import numpy as np
rw = [(3, 2*np.pi/3), (4, np.pi/2), (5, 2*np.pi/5)]
def area(t):
    (x1, y1), (x2, y2), (x3, y3) = [(r*np.cos(w*t), r*np.sin(w*t)) for r, w in rw]
    return (x2 - x1)*(y3 - y1) - (x3 - x1)*(y2 - y1)
ts = np.linspace(1e-5, 9, 4_000_000)
v = area(ts)
print(ts[:-1][np.diff(np.sign(v)) != 0][0])    # ~7.767
The three planets at their next collinear moment, near t = 7.77 years.
The three planets at their next collinear moment, near t=7.77t = 7.77 years.
Report an error on this page

Reports are stored by Netlify. See the privacy note.