Sunday Times Teaser 2669 – Extending the Garden
by Graham Smithers
George and Martha had a square garden whose sides were each 10 metres in length but they extended it by adding acute-angled triangles onto each side to create a new garden with eight straight sides.
The lengths of these eight sides are all different whole numbers of metres, the minimum being 1 metre and the maximum 13 metres.
Their average length is also a whole number of metres.
In increasing order, what are the lengths of the eight fences?
One Comment
Leave one →
-
brian gladman permalink123456789101112131415161718192021222324from itertools import combinationsc, triangles = 10, []# find all acute triangles with side lengths# a, b and c with c equal to 10 and a < bfor a in range(1, 14):for b in range(a + 1, 14):# ensure that the sides can make a triangleif a + b > 10 or b - a < 10:# ensure that the triangle is acuteif a * a + b * b + c * c > 2 * max(a, b, c) ** 2:# and this triangle to our listtriangles += [(a, b)]# combine triangles four at a timefor comb in combinations(triangles, 4):# find the set of eight side lengthssides = {y for x in comb for y in x}# the sides must all be different lengths, lengths of 1 and 13# must be present and the average length must be an integerif len(sides) == 8 and {1, 13} < sides and sum(sides) % 8 == 0:print(tuple(sorted(sides)), sum(sides) // 8, comb)