Skip to content

Sunday Times Teaser 2828 – Return to Zenda

by Nick MacKinnon

Published: 4 December 2016 (link)

Each postcode in Ruritania consists of ten digits, the first three showing the area, the next three showing the town, and the final four showing the house. Just twelve houses have “lucky” postcodes that have no repeated digit and which consist of two three-figure squares followed by a four-figure square. Rudolph lives in such a house and he recently met a girl called Flavia. She only told him that hers was the only house in her area with a lucky postcode, and that her area/town/house numbers were all bigger than his. He has found a postcode satisfying these conditions and sent her a Christmas card, but it has been returned as it was not her postcode.

What is Rudolph’s postcode?

2 Comments Leave one →
  1. Brian Gladman permalink

  2. I felt that the wording on this Teaser could have been a bit clearer.

    The code below uses squares that do not use leading zeros, and it turns out there exactly 12 “lucky” postcodes that can be constructed using this interpretation, so it is probably what the puzzle setter had in mind.

    The code uses some utility functions from the enigma.py library [ http://www.magwag.plus.com/jim/enigma.html ], and runs in 50ms.

    An alternative interpretation would be allow squares with leading zeros, which gives 34 possible “lucky” postcodes, but we are told only 12 of them are in use, which gives C(34, 12) = 131,128,140 different sets of “lucky” postcodes that may be in use. In this interpretation there is also the problem of how Flavia “knows” that hers is the only lucky postcode in her area. Is it the only possible lucky postcode in her area? Or just the only one (currently) in use? In my program I have implemented the latter.

    It is trivial to modify the program to consider this scenario (just change the a parameters in the calls to squares() to 0), and if you do it will find many hundreds of thousands of possible situations, and as there would be multiple answers for Rudolph’s postcode I think it’s probably not what the setter had in mind.

Leave a Reply

Note: HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS