From The Sunday Times, 29th March 1981 [link]
Recently I attended the Numerical Astrologers Conference, held annually in Brighton. At this meeting, members wore badges on which were written not only their names, but also their dates of birth. These dates were written numerically in the usual English manner of first putting the day, then the month, then the year (e.g. 7th March 1946 would be represented by 7/3/46, and the 31st December 1954 by 31/12/54). The year always uses two digits.
I had just entered the meeting when I was accosted by an internationally acclaimed cabalist, who, I noticed, shared with me the month of his birthday, though he was born in a year eight years prior to the year of my birth. He had been looking at my badge, and now told me that the digits of my date of birth were, in sequence, in exactly the reverse order to his own.
We were eagerly discussing this coincidence when an old acquaintance of mine introduced himself to the cabalist, who then made the same claim to my friend about their dates of birth. At first this puzzled me, as I knew my friend to be younger than myself, but, upon inspection, both the claims proved to be correct.
Strangely, both of us had dates of birth whose digits, when taken in completely the reverse order, were exactly the same as those of the cabalist.
Numerically, what was the cabalist’s date of birth?
The puzzle is included in the book The Sunday Times Book of Brainteasers (1994).
[teaser975]
Jim Randell 8:23 am on 22 May 2026 Permalink |
Here is a solution using the [[
SubstitutedExpression]] solver from the enigma.py library.The following run-file executes in 78ms. (Internal runtime of the generated code is 211µs).
Solution: The prices were: 239p, 716p, 845p.
The total amount spent being 1800p = £18.
LikeLike
ruudvanderham 9:52 am on 22 May 2026 Permalink |
import peek import istr set123456789=set(istr.range(1, 10)) for price2 in istr.range(1, 1000): price1 = 3 * price2 - 1 if price2 < 1000 and (price1 | price2).all_distinct(): for price0 in istr.range(price1 + 1, 1000): if set(price0 | price1 | price2) == set123456789 and (price0 + price1 + price2)[-2:]=="00": peek(price0, price1, price2, price0 + price1 + price2)LikeLike
ruudvanderham 1:37 pm on 22 May 2026 Permalink |
Here’s a different (significantly faster) version:
import peek import istr set123456789 = set(istr.range(1, 10)) for price2 in istr.range(1, 1000): price1 = 3 * price2 - 1 if price2 < 1000: for total in istr.range((price2 + price1 * 2 + 1).ceil(100), 3000, 100): price0 = total - price1 - price2 if price0 >= 1000: break if set(price0 | price1 | price2) == set123456789: peek(price0, price1, price2, price0 + price1 + price2)LikeLike
Frits 5:22 pm on 2 June 2026 Permalink |
# prices p1 < p2 < p3 for p2 in range(123 * 3 - 1, 876 + 1, 3): if len(s3 := set(str(p2))) != 3: continue if '0' in s3: continue # calculate and check p1 if len(s6 := set(str(p1 := (p2 + 1) // 3)) | s3) != 6: continue if '0' in s6: continue # last 2 digits of p3 in order to get a whole number of pounds if not (11 < (l2_p3 := 100 - ((p1 + p2) % 100)) < 99): continue # different digits if not s6.isdisjoint(s2 := set(str(l2_p3))): continue # calculate first digit of p3 if len(f_p3 := set("123456789") - s6 - s2) != 1: continue if (p3 := 100 * int(f_p3.pop()) + l2_p3) <= p2: continue print(f"answer: {p1}, {p2} and {p3}")LikeLike