Sunday Times Teaser 2689 – The Right Choice
by Des MacHale
I have cut many triangles of equal area from large sheet of card that is the same on both sides. The angles in all these triangles are whole numbers of degrees and all are 90 degrees or less. I have included all possible, different triangles of this form.
Entrants in a competition pick a triangle at random (replacing it afterwards) and they win if their triangle contains a right angle.
It turns out that their chances of winning are “1 in a whole number”. What is this number?
One Comment
Leave one →
-
brian gladman permalink12345678910111213141516171819202122from fractions import Fraction# for saving different triangles and counting winnersseen, wins = set(), 0# the first angle (a) is between 1 and 90 inclusivefor a in range(1, 91):# set the limits on the second angle (b) such that it and# the third angle (c) are both less than or equal to 90for b in range(max(1, 90 - a), min(91, 180 - a)):angles = tuple(sorted((a, b, 180 - (a + b))))# count this triangle if we have not seen it beforeif angles not in seen:seen.add(angles)# check if it is a winnerif 90 in angles:wins += 1f = Fraction(wins, len(seen))fs = 'The chances of winning are {} in {}.'print(fs.format(f.numerator, f.denominator))