Sunday Times Teaser 2492 – No Title
by Victor Bryant
Published June 27 2010 (link)
I started with a rectangular piece of paper and made a cut across it, dividing it into a triangle and a pentagon. Then I discarded the triangle and measured the lengths of the sides of the pentagon, all of which were whole numbers of centimetres.
I remember that the lengths of the shortest two sides were 17cm and 19cm, and that the length of the longest side was 33cm.
What were the lengths of the other two sides?
One Comment
Leave one →
-
Brian Gladman permalink123456789101112131415161718192021222324from collections import defaultdictfrom number_theory import pythag# store pythagorean triangles up to a side length of 33c2ab = defaultdict(list)for a, b, c in pythag(34):c2ab[c].append((a, b))# consider rectangles of width w and height hfor w in range(17, 34):for h in range(17, w):# and possible trianglesfor c in c2ab.keys():for a, b in c2ab[c]:for u, v in ((a, b), (b, a)):# form the sides of the pentagond, e, f, g, hh = t = tuple(sorted((w, h, c, w - u, h - v)))# and check that its two shortest and its longest# sides match the given valuesif (d, e) == (17, 19) and hh == 33:print(f'Answer: {f}, {g} [rectangle ({h}, {w}), 'f'pentagon {t}, triangle ({a}, {b}, {c})]')