Brain-Teaser 542: Finger trouble
From The Sunday Times, 14th November 1971 [link]
The Wabu tribesmen, though invariably truthful, are inveterate thieves, and this despite a tribal law which requires any man convicted of theft to have one finger amputated. Few of them now have a full complement and, since they count on their fingers, their answers to numerical questions are confusing to the outsider. (For instance, an 8-fingered man gives his answers to base 8, so that, for example, our figure 100 is for him 144).
Despite these handicaps, they are keen cricketers, and I recently watched their First Eleven. The Chief told me: “Only little Dojo has 10 fingers; the worst-equipped are Abo, Bunto and Coco with 4 apiece”. (I need hardly add that the Wabu would never elect a Chief who had been convicted of theft).
Later I asked some members of the team how many fingers (thumbs are, of course, included) the Eleven totalled. Epo said “242”, and Foto agreed; Gobo said “132”, and Hingo agreed. Kinko added: “I have more fingers than Iffo”.
How many fingers each have Epo, Hingo, Iffo and Jabo (the Wicket-keeper)?
This puzzle is included in the book Sunday Times Brain Teasers (1974).
[teaser542]









Jim Randell 8:41 am on 30 July 2024 Permalink |
We can use the [[
SubstitutedExpression]] solver from the enigma.py library to solve this puzzle.The following run file executes in 83ms. (Internal runtime of the generate code is 1.9ms).
Run: [ @replit ]
Solution: Epo has 5 fingers; Hingo has 7 fingers; Iffo has 8 fingers; Jabo has 9 fingers.
The number of fingers for each member of the team are:
And the total given in the appropriate bases:
LikeLike
Ruud 4:14 pm on 30 July 2024 Permalink |
It is really simple to solve this one by hand.
But, here’s my as brute as possible code:
import itertools a = b = c = 4 d = 10 for e in range(5, 11): sum_e = int("242", e) for g in range(4, 11): sum_g = int("132", g) if sum_e == sum_g: f = e h = g ijk = sum_e - (a + b + c + d + e + f + g + h) for i, j, k in itertools.product(range(1, 10), repeat=3): if i + j + k == ijk and k > i: print(f"Epo={e} Hingo={h} Iffo={i} Jabo={j}")LikeLike
Ruud 7:30 pm on 30 July 2024 Permalink |
Even more brute force:
import itertools a = b = c = 4 d = 10 for e, f, g, h, i, j, k in itertools.product(range(5, 10), repeat=7): if e == f and g == h and (total := int("242", e)) == int("132", g) and k > i and (a + b + c + d + e + f + g + h + i + j + k) == total: print(f"Epo={e} Hingo={h} Iffo={i} Jabo={j}")LikeLike
Frits 1:44 pm on 31 July 2024 Permalink |
from enigma import SubstitutedExpression # the alphametic puzzle p = SubstitutedExpression( [ # G*G + 3*G - 2*(E*E + 2*E) = 0 "is_square(1 + G * (G + 3) // 2) - 1 = E", "K > I", "(G * (G + 3) + 2) - (A + B + C + D + E + E + G + G + I + J) = K", ], answer="(E, G, I, J)", distinct="", s2d=dict(A=4, B=4, C=4, D=10), digits=range(5, 10), verbose=0, # use 256 to see the generated code ) names= "Epo Hingo Iffo Jabo".split() # print answers for ans in p.answers(): print(f"{', '.join(f'{x}: {str(y)}'for x, y in zip(names, ans))}")LikeLike