New Scientist Enigma 948 – Losing Time
by Colin Singleton
From Issue #2103, 11th October 1997
The church clock has developed a serious fault. The escapement keeps perfect time, but a small widget in the mechanism has become loose and drops out of place whenever the hands reach an exact hour. When the hour and minute hands next come together while the widget is misplaced, they rewind instantaneously to the previous exact hour (unless they are showing 12 o’clock) and the widget drops back into its correct position. The clock then continues running at the correct rate, but showing the wrong time.
If the hands come together with the widget correctly placed, nothing untoward happens.
The verger set the clock correctly at midnight on New Year’s Eve, and the fault became apparent over an hour later. If left unattended, when would the clock next be running normally and showing the correct (12 hour) time?
-
Brian Gladman permalink1234567891011121314151617181920212223242526272829303132333435from itertools import count# If we use 12 hours as the unit of time, the clock will instantly# lose (1/11 - 1/12) = 1/132 when it reads 1/11; it will lose twice# this when it reads 2/11, three times at 3/11 and so on up to the# last 1/11th at 10/11. This pattern repeats in each 12 hour period# so we can track real time and clock time and find the point when# the two are different by 12 hours.# the amount real time is ahead of clock time measured# in units of 1/132 of a 12 hour periodrmc = 0# full 12 hour periodsfor hd in count(0):# the eleven points in a day where real time# jumps further ahead of clock timefor n in range(11):# increment the difference between real time and# clock timermc += n# the clock time in hoursct = 12 * hd + n# find the time when the time difference# is a full 12 hour periodx, r = divmod(rmc, 132)if rmc and not r:# calculate the real time in hoursrt = ct + 12 * x# convert to days and hoursd, h = divmod(rt, 24)ap, h = divmod(h, 12)print(f"{h}:00{'AP'[ap]}M on {d + 1:02} January.")exit()