Teaser 3036: That old chestnut
From The Sunday Times, 29th November 2020 [link]
Clearing out an old drawer I found a wrinkled conker. It was my magnificent old 6709-er, a title earned by being the only survivor of a competition that I had had with friends. The competition had started with five conkers, veterans of many campaigns; each had begun at a different value between 1300 and 1400.
We used the rule that if an m-er beat an n-er in an encounter (by destroying it, of course!) the m-er would become an m+n+1-er; in effect, at any time the value of a conker was the number of destroyed conkers in all confrontations in its “ancestry”.
I recall that at the beginning of, and throughout, the competition, the value of every surviving conker was a prime number.
What were the values of the five conkers at the start?
[teaser3036]
Jim Randell 2:10 pm on 27 November 2020 Permalink |
There are 5 conkers (with values, say A, B, C, D, E), and there are 4 matches where one conker is destroyed in each match. The ultimate winner ending up with a value of (A + B + C + D + E + 4), and we know this value is 6079.
This Python 3 program runs in 49ms.
Solution: The values of the five starting conkers were: 1301, 1303, 1361, 1367, 1373.
The conkers are:
And one possible sequence of matches is:
An alternative sequence is:
Note that by selecting pairs of conkers for battle by index (rather than value) we ensure that the program works even if more than one conker has the same value. It turns out that in the solution sequence all the conkers do have different values, so it is possible to get the correct answer with a less rigorous program.
LikeLike
Jim Randell 12:49 pm on 14 December 2020 Permalink |
Here’s a solution using [[
multiset()
]] from the enigma.py library, which is a bit neater than using indices (and also more efficient).This Python 3 program runs in 44ms.
LikeLike
Frits 5:58 pm on 28 November 2020 Permalink |
2 encounters are enough to filter out a unique solution (we have been told there is a solution).
Coding more encounters would have resulted in an even more messy code.
LikeLike