Sunday Times Teaser 2925 – “The Eternal Triangle” — Go Figure!
by Stephen Hogg
Published October 14 2018 (link)
From my desk I saw the above when Leigh and Bob put 8392546137 and 4613725808 into two of the identical calculators used by my class. Everyone was told to press “clear”, then enter their unique three-figure pupil number (between 100 and 999) and divide this by the total number of display segments seen in it. If the result was a whole number they were to repeat the process with that result and its segment count (and so on until a decimal fraction part arose). Leigh, Bob and Geb each made four “divisions” this way. Using their three initial values as the sides of a triangle (Bob’s shortest, Geb’s longest), I told them to find its area.
What was Leigh’s number?
One Comment
Leave one →
-
Brian Gladman permalink12345678910111213141516171819202122232425262728from itertools import combinations# the number of active segments in the# digits of a seven segment display# 0 1 2 3 4 5 6 7 8 9segs = ( 6, 2, 5, 5, 4, 5, 6, 3, 7, 6 )# perform the repeated division process for <nbr> and return# True if it gives its first fraction on the fourth rounddef good(nbr):cnt, r = 0, 0while not r:cnt += 1nbr, r = divmod(nbr, sum(segs[int(x)] for x in str(nbr)))return cnt == 4# list the pupil numbers that survive the processnbrs = [n for n in range(100, 1000) if good(n)]# choose numbers for Bob, Leigh and Gebfor b, l, g in combinations(nbrs, 3):# calculate the triangle's areas = (b + l + g) / 2t = s * (s - b) * (s - l) * (s - g)if t >= 0:print(f'(Bob, Leigh, Geb) = {(b, l, g)}, Triangle Area = {t ** 0.5:,.2f}')