# Enigmatic Code

Programming Enigma Puzzles

## Enigma 481: Seconds out?

From New Scientist #1632, 29th September 1988 [link]

Professor E. Mit was somewhat puzzled, as the experiment he had been conducting had been a complete failure. After some investigation the cause was pinpointed to a faulty timing device, which measure time in minutes and hours only, in a 12 hour format with no distinction between am and pm.

Having replaced the offending clock, Mit decided to ascertain the nature of the error. This he did as follows; placing the faulty clock alongside an identical one which was known to keep the correct time and starting both clocks at the same time, he observed that the erroneous clock gained one minute in the first minute, two minutes in the second minute, three minutes in the third minute, and so on. For example, if both clocks start at 12:00:

If both clocks start as above at 12:00 precisely, what time will it be when the faulty clock next shows the correct time?

This puzzle was originally published in the last issue of New Scientist to carry an issue date that falls on a Thursday. Subsequent issues have an issue date that falls on a Saturday.

[enigma481]

### 2 responses to “Enigma 481: Seconds out?”

1. Jim Randell 31 December 2018 at 9:14 am

This Python program runs in 79ms.

Run: [ @repl.it ]

```from itertools import count
from enigma import T, sprintf as f, unpack

# return displayed (hours, minutes)
def display(t):
(h, m) = divmod(t, 60)
(_, h) = divmod(h, 12)
return ((12 if h == 0 else h), m)

# format a (h, m) time
fmt = unpack(lambda h, m: f("{h}:{m:02d}"))

for t in count(0):
a = display(t)
b = display(t + T(t))
print(f("[t={t}] {a} -> {b}", a=fmt(a), b=fmt(b)))
if a == b and t > 0: break
```

Solution: The faulty clock will next show the correct time at 3:44.

And then 9:35, 10:39, 1:20, 2:24, 8:15, 11:59, 12:00. The sequence then repeats.

Each correct time is preceded by the faulty clock reading 11:59. In particular after 23h58m, the correct clock reads 11:58 and the faulty clock reads 11:59, then at 23h59m the correct clock reads 11:59 and the faulty clock also reads 11:59, and one minute later both clocks read 12:00.

2. Hugh Casement 31 December 2018 at 10:43 am

Strange how those who compose Enigma puzzles always buy their clocks in the USA, where people not only don’t know how many kilometres there are in a foot but also haven’t yet discovered that there are 24 hours in a day.

I started my rather similar laboratory clock at 00:00 on the 30th. It showed the correct time at 09:35, 10:39, and 20:15; then 03:44, 13:20, 14:24, and 23:59 the next day (we look for triangular numbers that are multiples of 1440). At midnight it suffered terminal melt-down.

This site uses Akismet to reduce spam. Learn how your comment data is processed.