Enigmatic Code

Programming Enigma Puzzles

Enigma 535: For old time’s sake

From New Scientist #1687, 21st October 1989 [link]

“What time is it dear?” asked old Mrs Protheroe, from her wheelchair. “Is it time for the evening news yet?” Her husband pulled the watch, on the end of its chain, from his waistcoat pocket. “Drat! It’s stopped; I must have forgotten to wind it up last night.”

“That’s no cause for you to use such strong language,” snapped his wife. “Anyway, Joanna has left her watch on the sideboard. Perhaps that’s working.”

Mr Protheroe picked up his grand-daughter’s watch and stared at it. Now he was what one might call old-fashioned: he had no truck with modern contraptions, like digital watches. His brow furrowed in concentration as, for the first time in his life, he tried to decipher the strange looking figures on the face of the watch. He turned it first one way, then the other, until, with a triumphant “Ah!”, he announced the correct time to his wife.

What Mr Protheroe did not realise was that:

(a) He was holding the watch upside-down;
(b) The watch was 21 minutes slow.

Nevertheless, the time he announced was the correct one.

What time was it?

[enigma535]

One response to “Enigma 535: For old time’s sake

  1. Jim Randell 4 February 2020 at 10:04 am

    I only considered cases where the digits observed by Mr Protheroe would read as the correct time.

    But there are more complicated situations where times could be confused:

    22:10 = “twenty-two, ten”
    21:40 = “twenty to ten”

    This Python program runs in 86ms.

    Run: [ @repl.it ]

    from itertools import product
    from enigma import irange, nsplit, nconcat, printf
    
    # digits that can be inverted
    inv = { 0: 0, 1: 1, 2: 2, 5: 5, 6: 9, 8: 8, 9: 6 }
    
    # invert a sequence of digits
    def inverted(ds):
      try:
        return list(inv[d] for d in reversed(ds))
      except KeyError:
        return None
    
    # are times equvalent?
    def time_eq(h1, m1, h2, m2):
      return m1 == m2 and abs(h1 - h2) % 12 == 0
    
    # consider possible hh:mm times in the evening
    for (hh, mm) in product(irange(18, 23), irange(0, 59)):
    
      # but the watch is 21 minutes slow ...
      (h, m) = divmod(hh * 60 + mm - 21, 60)
    
      # and upside down
      ds = inverted(nsplit(h, 2) + nsplit(m, 2))
      if ds is None: continue
    
      # but do the digits give the correct time?
      (h2, m2) = (nconcat(ds[:2]), nconcat(ds[2:]))
      if time_eq(hh, mm, h2, m2):
        # output solution
        printf("{hh:02d}:{mm:02d} -> {h:02d}:{m:02d} -> {h2:02d}:{m2:02d}")
    

    Solution: The time was 10:22 pm.

    The time displayed on the digital watch, which was running 21 minutes slow, was: “22:01”.

    Mr Protheroe looked at the watch upside down and saw: “10:22”.

    So he announced the time as: “ten, twenty-two”.

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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

%d bloggers like this: