Teaser 2458: [Chocolate cylinders]
From The Sunday Times, 1st November 2009 [link]
Willy took a cylindrical cake of radius a whole prime number of millimetres. He coated the curved surface with a layer of chocolate an odd prime number of millimetres thick and let it set. He repeated this a few times, building up layers of the same thickness. Being a silly Willy, he then left the cake in the sun and all the chocolate melted. So he used it to make nine solid cylinders of chocolate, each of radius 20 mm and length the same as the original cake.
How many layers of chocolate did he apply to the cake?
This puzzle was originally published with no title.
[teaser2458]
Jim Randell 8:15 am on 13 February 2026 Permalink |
Suppose the cake has radius r and height h.
Then, if n layers of chocolate, each of thickness t, are added, the total volume of chocolate used is:
And this same volume can also be used to make 9 solid cylinders of chocolate, each with a radius of 20 mm:
Hence:
The LHS is the difference of 2 squares, so can be rewritten:
So we can solve the puzzle by looking at the divisors of 60^2.
The following Python program runs in 68ms. (Internal runtime is 96ยตs).
from enigma import (divisors_pairs, div, is_prime, printf) # consider divisors of 3600 for (a, b) in divisors_pairs(60, 2): r = div(b - a, 2) if r is None or not is_prime(r): continue printf("r={r} [nt={a}]") for (n, t) in divisors_pairs(a, every=1): if not (t % 2 == 1 and is_prime(t)): continue printf("-> n={n} t={t}")Solution: Willy applied 10 layers of chocolate to the cake.
The situation is apparently:
So the cake is only 22 mm across, and it was then coated with 10 layers of 5 mm chocolate. Which means the finished item was 122 mm across with only a tiny 22 mm centre consisting of cake.
LikeLike
Ruud 9:48 am on 13 February 2026 Permalink |
import peek import istr for r, d, n in istr.product(istr.primes(1000), istr.primes(3, 1000), range(2, 20)): if (r + n * d) ** 2 - r**2 == 9 * (20**2): peek(r, n, d)LikeLike