Sunday Times Teaser 2856 – Solid Jellometry
by Stephen Hogg
Published 18th June 2017 (link)
As a wedding gift, Granny Lucci gave us a set of five jelly moulds, which was odd in many ways. The base of each mould was a different regular polygon (including a triangle) with each side an odd number of centimetres in length. Each polygon had the same length perimeter, an odd two figure number of centimetres.
The sides of the moulds were vertical and the heights of the moulds were all the same odd number of centimetres. The volumes of the moulds were all between one and two litres.
What was the height of the moulds?
One Comment
Leave one →
-
Brian Gladman permalink123456789101112131415161718192021222324252627from math import pi, tan, ceil, floorfrom itertools import combinations# calculate the area of a regular polygon from its number# of sides (n) and its perimeter (p) with x = (n, p)area = lambda x: 0.25 * x[0] * x[1] ** 2 / tan(pi / x[0])# consider odd two-digit poylygon perimetersfor p in range(11, 100, 2):# find the regular polygons with this perimeter from its# divisors giving the number of sides and their lengthspoly = {(n, p // n) for n in range(3, 100, 2) if not p % n}# consider all combinations of five regular polygonsfor p5 in combinations(sorted(poly, key=area), 5):# ... one of which is a triangleif p5[0][0] == 3:# calculate the minimum and maximum mould heights# from the minimum (1000) and maximum (2000) mould# volumes and the minimum and maximum base areash_min = ceil(1000 / area(p5[0]))h_max = floor(2000 / area(p5[-1]))# look for an odd height within this rangefor h in range(h_min, h_max + 1):if h & 1:print(f'Height {h}cm, Polygons {p5}')