Teaser 3254: Pizza pans
From The Sunday Times, 2nd February 2025 [link] [link]
In a large pan, James baked three identical circular pizzas whose radius was a whole number of cm (less than 75). He laid them on a platter so that one pizza overlapped the other two. The pizza centres formed a right-angled triangle, with sides that were whole numbers of cm. The two lengths of overlap and the gap between the two non-overlapping pizzas (all measured along the lines joining the pizza centres) were all whole numbers of cm and could have formed another right-angled triangle.
He baked a fourth, smaller, circular pizza and it just fitted inside the triangle formed by the centres of the other three. Even if you knew the radii of the pizzas, you couldn’t work out the size of those right-angled triangles.
What was the radius of the smallest pizza?
[teaser3254]





Jim Randell 7:22 am on 2 February 2025 Permalink |
The following Python program runs in 69ms. (Internal runtime is 571µs).
from enigma import (defaultdict, irange, pythagorean_triples, divc, rdiv, printf) # generate possible dimensions def generate(): # consider pythagorean triples (x, y, z) for (x, y, z) in pythagorean_triples(225): # consider possible radii for the pizza (R) for R in irange(divc(y + 1, 2), 74): RR = 2 * R (X, Y, Z) = (RR - y, RR - x, RR + z) if not (X * X + Y * Y == Z * Z): continue # calculate inradius of X, Y, Z (r = area / semiperimeter) r = rdiv(X * Y, X + Y + Z) # return (<radii>, <large triangle>, <small triangle>) yield((R, r), (X, Y, Z), (x, y, z)) # collect triangles by radii (R, r) d = defaultdict(list) for ((R, r), Ts, ts) in generate(): printf("[R={R} {Ts} -> {ts} r={r}]") d[(R, r)].append((Ts, ts)) # look for non-unique radii pairs for ((R, r), vs) in d.items(): if len(vs) < 2: continue # output solution printf("({R}, {r}) -> {vs}")Solution: The smaller pizza has a radius of 30 cm.
And the larger pizzas have radii of 60cm. (So each pizza is 120cm across! – that’s a big pizza).
One of the possible arrangements looks like this:
The overlaps are 10 cm and 24 cm, and the gap is 26 cm.
And the other possible arrangement looks quite similar, but the overlaps are 15 cm and 20 cm, and the gap is 25 cm.
LikeLike
Frits 6:36 am on 3 February 2025 Permalink |
from enigma import pythagorean_triples # let x, y, z be the lengths of the triangle of the overlaps and gap # let R be the radius of the 3 identical pizzas # RR = 2 * R # (X, Y, Z) = (RR - y, RR - x, RR + z) # right-angled: 4 * R**2 = 4 * (y * R + x * R + z * R) # so R must be equal to y + x + z seen = set() # consider pythagorean triples (X, Y, Z) for (X, Y, Z) in pythagorean_triples(4 * 75 - 1): # small and big radius # (x, y, z) = sorted([R2 - X, R2 - Y, Z - R2]) # x + y + z = 2R - X - Y + Z = 2R - 2r = R --> R = 2r R = (X + Y - Z) # r = R / 2 if (R2 := 2 * R) > 2 * 75: continue # x, y, z must be positive numbers if min(R2 - X, R2 - Y, Z - R2) < 1: continue if R in seen: print(f"answer: {r} cm") seen.add(R)LikeLike