Teaser 3320: Penblwydd Hapus
From The Sunday Times, 10th May 2026 [link] [link]
I’m now in my thirties and for many years I’ve treated myself to some bottles of beer on my birthday. To compensate for my increasing age, I buy the same number of bottles each year as my age. On my recent birthday, after storing my bottles, I noticed that, on the beer receipt from the supermarket, all of the nine digits 1 to 9 appeared once, and only once, in the number of bottles, the price per bottle in pence and the total cost in pence.
What was the total cost of the beer in pence?
[teaser3320]
















Jim Randell 12:20 am on 10 May 2026 Permalink |
I think the wording on this puzzle could be tightened up a little. (Specifically to clear up: “what constitutes a recent birthday?”, and “how many times can the digit 0 appear?”).
I assumed we are looking for a sum consisting of 9 digits, using each of the digits 1-9 exactly once, but I find multiple solutions. (And if we allow the digit 0 to appear then there are even more solutions).
Using birthdays in the last 5 years, but disallowing 0 digits, I get 3 candidate solutions. If we take “recent birthday” to mean “most recent birthday”, then we can eliminate two of these, so maybe that is what the setter intended.
This Python program runs in 88ms. (Internal runtime is 19ms).
from enigma import (irange, inf, nsplit, flatten, printf) # consider possible ages for a "recent" birthday for n in irange(26, 39): # consider price per bottle for p in irange(100, inf): # calculate the total cost t = n * p # find the digits used in the sum ds = flatten(nsplit(x) for x in (n, p, t)) # look for 9 different non-zero digits if len(ds) > 9: break if 0 not in ds and len(set(ds)) == 9: # output solution printf("{n} * {p} = {t}")Solution: The total cost of the beer was 7254p.
If we suppose the “recent birthday” is the setter’s most recent birthday (that perhaps happened within the last few weeks), then the birthday is 30 .. 39, and the only solution using just the 9 digits 1-9 exactly once is:
i.e. the beer cost 186p per bottle.
However, if the recent birthday is one of the last (say) 5 (the puzzle text does say the practice has been going on “for many years”), then it could be between 26 .. 39, and this permits the following additional solutions:
Also, the puzzle text does not place restrictions on how many occurrences of the digit 0 there may be, so we can get the following reasonable solutions:
And if very expensive bottles of beer were purchased there are further solutions with more than one 0 digit, e.g.:
In fact any solution can have the price per bottle and the total price multiplied by 10 to give a further solution if no restrictions are placed on the digit 0.
So, I think the intended puzzle is:
This revised puzzle is easily solved directly from the command line using the [[
SubstitutedExpression]] solver from the enigma.py library:(The internal runtime of the generated code is 550µs).
LikeLike
Ruud 6:48 am on 10 May 2026 Permalink |
It is easy to see that the price should have 3 digits and the total cost 4 digits.
import peek import istr for age in istr.range(31, 40): for rest in istr.permutations({*istr.range(1, 10)} - {*age}): if (price := istr.join(rest[:3])) * age == (total := istr.join(rest[3:])): peek(age, price, total)LikeLike
Frits 11:04 am on 10 May 2026 Permalink |
# forbidden unit digits (3 is reserved for the tens digit of the age) fb = {0, 3} # dictionary of price unit digits per n_bottles unit digit d = {b: {p for p in range(10) if p not in fb and p != b and (u := (p * b) % 10) not in fb | {b, p}} for b in range(10) if b not in fb} # the number of bottles (equal to age) for b in [n for n in range(30, 40) if n % 10 in d]: # unit digit u = b % 10 # minimum/maximum price, price/cost should have resp. 3/4 digits mn, mx = 124, 9876 // b #pr(b, (mn, mx), (b * mn, b * mx), d[u]) # the price per bottle in pence for p in [n for n in range(mn, mx + 1) if n % 10 in d[u]]: if '0' in (dgts := set(str(b) + str(p) + str((c := b * p)))): continue if len(dgts) == 9: print(f"answer: {c}p")LikeLike
Hugo 12:29 pm on 12 May 2026 Permalink |
Keeping the pattern AB × CDE = FGHI but without the condition that A = 3, I found
18 × 297 = 5346
27 × 198 = 5346
28 × 157 = 4396
42 × 138 = 5796
48 × 159 = 7632
I didn’t try any other patterns, with or without the inclusion of 0.
No doubt Jim can fill that gap for us.
LikeLike
Tony Smith 11:04 am on 13 May 2026 Permalink |
12 x 483=5796
LikeLike
Ruud 8:38 am on 14 May 2026 Permalink |
And
4 x 1738 = 6952
4 x 1963 =7852
LikeLike