Brain teaser 1023: A mixed maths class
From The Sunday Times, 7th March 1982 [link]
My mathematics class consists of six boys and six girls. In their annual examination each was awarded integral an mark out of 100.
Disappointingly no boy received a distinction (over 80) but all the boys managed over 40. The lowest mark in the class was 36.
Upon listing the boys’ marks I noticed that all their marks were different prime numbers and that their average was an even number. Further three of the boys’ marks formed an arithmetic progression, and the other three another arithmetic progression.
Turning, my, attention to the girls I found that their marks were all different. There was little overall difference in the performance of the sexes, the total of the girls’ marks being just one more than the total of the boys’. Three of the girls’ marks formed one geometric progression, and the other three formed another geometric progression with the same ratio as the first one.
Finally when listing the results in numerical order I was pleased to see that Annie (who did so badly last year) had come seventh in the class.
What were the top six marks (in descending order)?
This puzzle is included in the book The Sunday Times Book of Brainteasers (1994).
[teaser1023]










Jim Randell 1:35 pm on 10 March 2024 Permalink |
This Python program looks at possible scores for the boys and the girls and then looks for a common key (for the boys the key is the sum of the scores, for the girls it is the sum minus 1), and then checks for possibilities that place a girl (Annie) in 7th position.
It runs in 60ms. (Internal runtime is 3.0ms).
from enigma import ( irange, primes, subsets, partitions, seq_all_same, tuples, fraction, group, item, intersect, cproduct, printf ) # does sequence <seq> form an arithmetic progression is_arithmetic = lambda seq: seq_all_same(y - x for (x, y) in tuples(seq, 2)) # generate possible marks for the boys def gen_boys(): # the marks are 6 different primes between 41 and 80 for bs in subsets(primes.between(41, 80), size=6): # and their average is an even number t = sum(bs) if t % 12 != 0: continue # and they form two 3-length arithmetic progressions for (b1, b2) in partitions(bs, 3): if not (is_arithmetic(b1) and is_arithmetic(b2)): continue printf("[boys = {b1} + {b2} -> {t}]") # return (<total>, (<series1>, <series2>)) yield (t, (b1, b2)) # generate possible marks for the girls def gen_girls(): # choose geometric progression that start 36 a = 36 for b in irange(37, 100): (c, r) = divmod(b * b, a) if c > 100: break if r != 0: continue # now look for another geometric progression with the same ratio = b/a for x in irange(37, 100): (y, ry) = divmod(x * b, a) (z, rz) = divmod(y * b, a) if z > 100: break if ry != 0 or rz != 0: continue t = sum([a, b, c, x, y, z]) - 1 printf("[girls = ({a}, {b}, {c}) + ({x}, {y}, {z}); r={r} -> {t}]", r=fraction(b, a)) # return (<total> - 1, (<series1>, <series2>)) yield (t, ((a, b, c), (x, y, z))) # group boys by total boys = group(gen_boys(), by=item(0), f=item(1)) # group girls by total - 1 girls = group(gen_girls(), by=item(0), f=item(1)) # look for common keys for k in intersect([boys.keys(), girls.keys()]): for ((b1, b2), (g1, g2)) in cproduct([boys[k], girls[k]]): # marks in order ms = sorted(b1 + b2 + g1 + g2, reverse=1) # 7th position (= index 6) must be a girl if not (ms[6] in g1 + g2): continue # output solution printf("boys = {b1} + {b2}, girls = {g1} + {g2} -> {ms}")Solution: The top six marks were: 90, 81, 79, 73, 67, 60.
The only scenario is:
Which gives the following sequence of scores:
This the only scenario where the 7th best score is a girl.
Although there are two other scenarios for the boys that have the right sum, but each places a boy in 7th place overall:
Separately there are 5 possible scenarios for the boys and 5 for the girls, but only those sequences with sums of 360/361 give matching keys.
LikeLike