Sunday Times Teaser 2922 – Inscribed
by Andrew Skidmore
Published September 23 2018 (link)
The Republic of Mathematica has an unusual rectangular flag. It measures 120 cm by 60 cm and has a red background. It features a green triangle and a white circle. All the lengths of the sides of the triangle and the radius of the circle (which touches all three sides of the triangle) are whole numbers of cm. Also, the distances from the vertices of the triangle to the centre of the circle are whole numbers of cm. The flag has a line of symmetry.
What is the length of the shortest side of the triangle?
One Comment
Leave one →
-
Brian Gladman permalink123456789101112131415161718192021222324252627282930313233343536373839from collections import defaultdictfrom itertools import permutationsfrom number_theory import pythag# the triangle is isoceles (b, c, c) with base b,# height h and incircle radius r = b.h / (b + 2.c)## the height h is given by h^2 = c^2 - (b / 2)^2# with the distance from the top vertex to the# centre of the circle being h - r## the distance from a lower vertex to the circle# centre is given by l^2 = r^2 + (b / 2)^2## hence we need two pythagorean triangles with# the same side (b / 2):## (b / 2, h, c) and (b / 2, r, l)# store pythagorean triangles indexed on twice# their non-hypotenuse sides (i.e. b)s2p = defaultdict(list)for x, y, z in pythag(h_max = 120):s2p[2 * x].append((y, z))s2p[2 * y].append((x, z))# consider sides (b) that give two or more trianglesfor b, tl in s2p.items():if len(tl) >= 2:# consider pairs of triangles for (h, c) and (r, l)for (h, c), (r, l) in permutations(tl, 2):# compute the incircle radius and check it against# the value from the pythagorean triangleif divmod(h * b, b + 2 * c) == (r, 0):print(f'b = {b}, c = {c}, r = {r}, l = {l}, h = {h}')