### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,158)
- misc (2)
- project euler (2)
- puzzle (40)
- site news (44)
- tantalizer (42)
- teaser (3)

### Site Stats

- 178,002 hits

Advertisements

Programming Enigma Puzzles

10 February 2017

Posted by on **From New Scientist #1532, 30th October 1986** [link]

My watch is pretty accurate — when it’s working. It has a sweep second-hand that advances in jerks, one each second; if the watch stops, it stops with the second hand pointing directly to one of the 60 “second” (or “minute”) marks round the rim. At noon all three hands are (naturally) pointing directly to the zero-minute mark.

At noon yesterday my watch was certainly working, but when I checked it at 6:00 pm I found that it had stopped. The angles the three hands made with each other all differed from 120 degrees by less than 1 degree.

At what time had my watch stopped? (Hours : minutes : seconds).

[enigma383]

Advertisements

%d bloggers like this:

I always thought a “sweep second hand” meant that the second hand moved continuously (or in small enough increments it appears to be continuous). But it doesn’t. It means the second hand is on the same dial as the hour and minute hands (instead of having its own separate little dial). So it is possible to have a “sweep second hand” that “advances in jerks”.

This Python program runs in 264ms.

Solution:The watch had stopped at 5:49:09 pm.A similar configuration would also occur at 6:10:51 pm (which is close to being a vertical reflection of the solution), but these are the only two times that work.

If we choose a position for the second hand, then this defines two narrow regions that the minute hand can fall in, and if we find a suitable position for the minute hand this gives a single narrow region that the hour hand can fall in.

This Python program uses this approach, so considers fewer possibilities. I also expanded the equations so that everything is calculated using integers. It runs in 39ms.

We can find the further solution by removing the restriction on

Hat line 49.My previous version considered the 60 possibilities for

S, and for each of those tried the 60 possibilities forM. Out of the 3600 possibilities, 38 of them prove to be viable, and for each viable possibility the 6 values forHare tried.This program considers the 60 possible positions of the second hand, and for each one it looks to see if the minute hand can be positioned in a region either 120° or 240° further on. So instead of 3600 possibilities it only tries 120 (and finds the same 38 viable pairs), then for each of those possibilities it looks to position the hour hand in the other region, and if that proves to be possible we finally check that the angle between the hour and minute hands is within the required range.

Even though this approach is faster I think the original program is fast enough, and probably easier to modify to accommodate problems of a similar nature. (And both approaches are, of course, faster than just trying all possible 6 × 60 × 60 = 21,600 possible hand positions).