Enigmatic Code

Programming Enigma Puzzles

Enigma 134: Remember, remember

From New Scientist #1278, 5th November 1981 [link]

The fated three sat in “Ye Ink and Blott”
To settle when to carry out the plot.
Said Fawkes “I have this day my passage set:
Before the month is ended I’ll have fled.
Now tell me John and Thomas, if you please,
How many days you’ve free before I leave.”

So John did now the wanted figure state
(The days he’d counted many times of late!)
Tom said he’d three-quarter many days as John
On which he could be there to set the bomb.
“And Tom, I’ve three-quarter many days as thee —
Therefore a handsome choice of dates there’ll be.”

But Guy was wrong since there was just one day
On which all three could be there for the fray.
(One was the smallest number which there could
Have possibly been with the figures as they stood.)
And hence Guy Fawkes did solemnly decree
“The fifth day of November it shall be.”

Tell me, how many days did there remain
Before the day Guy planned to sail away?

This puzzle is a reference to Guy Fawkes, a conspirator in the Gunpowder Plot, the failure of which is traditionally celebrated in Britain on 5th November.



One response to “Enigma 134: Remember, remember

  1. Jim Randell 11 October 2013 at 8:48 am

    I found this one a little confusingly worded, but I interpreted it as follows.

    Guy Fawkes leaves in N days, and is available for “doing the deed” on G of those days. Tom is available on T of those days. John is available on J of those days. And G/T= T/J = ¾. So G < T < J ≤ N. We need to find N given that for any possible availabilities (G, T, J) from N days there must be at least one day where G, T and J are all available.

    The analysis doesn't leave much for a program to do, but here's some Python code that runs in 32ms.

    from itertools import count
    from enigma import irange, printf
    # since T = 3J/4 and G = 3T/4 then G = 9J/16,
    # so J must be divisible by 16, and G < 30
    for J in count(16, 16):
      T = 3 * J // 4
      G = 3 * T // 4
      if G > 29: break
      # now suppose Fawkes leaves in N days
      # N must be at least J and less than G + T to ensure overlap
      # and cannot exceed 29, as all the days are in November 1605
      # the minimum overlap between T and J is TJ = (T + J) - N
      # and for G to overlap with exactly one of TJ
      # we must have G - 1 = N - TJ
      # hence: 2N + 1 = G + T + J
      (N, r) = divmod(G + T + J - 1, 2)
      if r > 0 or N > 29: continue
      printf("N={N} [G={G} T={T} J={J}]")

    Solution: Guy Fawkes leaves in 18 days.

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: