Sunday Times Teaser 2595 – Stylish Fences
by Rex Lanham
Published: 17 June 2012 (link)
Farmer Giles has a hexagonal field bounded by six straight fences. The six corners lie on a circle of diameter somewhere around 250 metres. At three alternate corners there are stiles. The angles of the hexagon at the corners without stiles are all the same. All six fences are different whole numbers of metres long. I have just walked in a straight line from one of the stiles to another and the distance walked was a whole number of metres.
How many?
One Comment
Leave one →

Brian Gladman permalink12345678910111213141516171819202122232425262728293031from collections import defaultdict# The distances between the stiles are chords to the circle with# the three equal subtended angles at the intermediate corners.# This means that they have equal subtended angles at the centre# of the circle so the chords form an equilateral triangle with# subtended angles of 120 degrees at the centre. When on opposite# sides of a chord, the angle subtended by a chord at a point on# the circle is 180  half the angle subtended at the circle's# centre, which gives the angles at the intermediate corners as# 120 degrees. So with a chord length of l (which is equal to# sqrt(3) /2 times the diameter of the circle) and the lengths# of the two fences between two stiles as a and b, we have:## l^2 = a^2 + b^2 + a.b## Since we need three different (a, b) pairs, we need a length l# (around 216m) that gives at least three solutionws for a and b.d = defaultdict(set)for a in range(1, 220):for b in range(1, a):l2 = a * a + b * b + a * bl = int(l2 ** 0.5)if l2 == l * l:d[l].update([(a, b)])for l in d:if len(d[l]) >= 3 and 210 < l < 220:print('Length {0:3} metres {1:}'.format(l, d[l]))