When the High Street Blinks as One: A Switch-On Solved With LCMs
Photo: Chris Whippet , CC BY-SA 2.0, via Wikimedia Commons
At 5pm on switch-on day, the high street is a row of shop windows blinking at different rates. The baker's fairy lights cycle every 6 seconds. The estate agent's icicle lights every 8. The phone shop every 10. The charity shop every 15. For most of the evening they look like a mess. Then, for one glorious moment, every window flashes at once. When is that moment? This is a least common multiple problem wearing a Santa hat.
Two displays and one common multiple
Take the baker and the estate agent. One display flashes every 6 seconds, the other every 8. They flash together at times that are multiples of both 6 and 8: 24 seconds, 48 seconds, 72 seconds, and so on. The first such moment is the least common multiple, LCM(6, 8) = 24.
You can find it from prime factors. 6 = 2 × 3, and 8 = 2^3. The LCM takes the highest power of each prime that appears: 2^3 × 3 = 24. Multiplying 6 × 8 = 48 would double-count the shared factor of 2. The LCM is the smallest positive time that both cycles divide exactly.
The whole street
Now add the phone shop and the charity shop. Their periods are 10 and 15 seconds. Factor them all:
6 = 2 × 3 8 = 2^3 10 = 2 × 5 15 = 3 × 5
The highest powers are 2^3, 3 and 5, so the LCM is 2^3 × 3 × 5 = 120. That is two minutes. If all four displays start together at 17:30:00, they all flash together at 17:32:00, 17:34:00, 17:36:00 and so on. The street has a two-minute heartbeat.
But displays do not start together
Real shopfronts are switched on by different people, often with different controllers. Suppose display A flashes when t is a multiple of 6, so t ≡ 0 (mod 6). Display B flashes 2 seconds after switch-on and then every 8 seconds, so t ≡ 2 (mod 8). We need a time t that satisfies both congruences:
t ≡ 0 (mod 6) t ≡ 2 (mod 8)
Try multiples of 6: 0, 6, 12, 18, 24, 30, 36, 42. The first one that leaves remainder 2 on division by 8 is 18, because 18 = 2 × 8 + 2. So the two displays sync at 18 seconds, then again after LCM(6, 8) = 24 seconds: 42, 66, 90, and so on.
Add a third display C that flashes every 10 seconds with a 4-second offset: t ≡ 4 (mod 10). We already have t = 18 + 24k. Modulo 10, that is 8 + 4k. Set 8 + 4k ≡ 4 (mod 10), so 4k ≡ 6 (mod 10). Divide by 2: 2k ≡ 3 (mod 5). The inverse of 2 modulo 5 is 3, so k ≡ 9 ≡ 4 (mod 5). The smallest k is 4, giving t = 18 + 96 = 114 seconds. All three flash together at 114 seconds after switch-on, then every LCM(6, 8, 10) = 120 seconds.
When the street never syncs
Offsets can also make synchronisation impossible. Suppose A flashes at t ≡ 0 (mod 6) and B at t ≡ 1 (mod 8). Any multiple of 6 is even, but any number congruent to 1 modulo 8 is odd. There is no solution. In general, a pair of congruences t ≡ r (mod m) and t ≡ s (mod n) has a solution only if r − s is divisible by the greatest common divisor of m and n. If that test fails, the displays never flash together, no matter how long you stand there in the cold.
This is the part that surprises people. LCM tells you the repeat time when a sync exists. The gcd tells you whether it exists at all.
A pavement check
You can do the whole thing from the pavement with a phone stopwatch. Time one full cycle of each display. Note the first flash after switch-on, which gives the offset. If every display starts together, just take the LCM of the periods. If not, write down congruences and look for the smallest non-negative t that satisfies them all. Listing multiples is usually enough for a handful of displays. The Chinese remainder theorem explains why the solutions repeat every LCM once you find one.
So the switch-on is not magic. It is modular arithmetic with tinsel. The high street blinks in equations, and once every LCM it admits it.