Teaser 2524: [Whispered birthday]
From The Sunday Times, 6th February 2011 [link] [link]
My birthday is on the first of a month. My three logical friends Lettice, Daisy and Bertha wanted to know which month. So I whispered to Lettice the number of letters in the spelling of the month, I whispered to Daisy the number of days in the month, and I whispered to Bertha the day of the week of my birthday this year. I explained to all three what I had done and then I asked them in turn whether they were able to work out the month yet. Their replies were:
Lettice: no
Daisy: no
Bertha: no
Lettice: no
Daisy: no
Bertha: yesWhat is my birthday month?
This puzzle was originally published with no title.
[teaser2524]
Jim Randell 7:53 am on 17 June 2025 Permalink |
This Python program uses the [[
filter_unique()]] function from the enigma.py library to eliminate candidate solutions at each step.It runs in 70ms. (Internal runtime is 263µs).
from enigma import (filter_unique, printf) # month names months = "January February March April May June July August September October November December".split() # maps month names to: L = number of letters; D = number of days; B = day of week of 1st L = dict((k, len(k)) for k in months) D = dict(zip(months, [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31])) # for 2011 B = dict(zip(months, "Sa Tu Tu Fr Su We Fr Mo Th Sa Tu Th".split())) # for 2011 # start with all possible months ss = months # answers: 1 = "no" (non_unique), 0 = "yes" (unique) for (d, i) in [(L, 1), (D, 1), (B, 1), (L, 1), (D, 1), (B, 0)]: ss = filter_unique(ss, d.get)[i] # output solution(s) for m in ss: printf("month = {m}")Solution: The birthday month is March.
LikeLike