From The Sunday Times, 5th June 1983 [link]
In our club we have three one-armed bandits. The Saturn Skyjacker accepts 10p, 2p and 1p coins, the Mars Marauder accepts 10p and 1p coins, and the Aries Axeman accepts 5p and 2p coins.
I am the club treasurer, so each week I have the onerous task of emptying the machines and counting the coins. Last week, my efforts were rewarded with the discovery of an interesting series of coincidences. On counting the coins for the Saturn Skyjacker, I found that there were the same number of coins of two of the denominations, and that the number of coins of the third denomination differed from this number by only one. In addition, the total value of all the coins was an exact number of pounds less than one hundred.
The coins from the Mars Marauder were similarly distributed: the numbers of 10p and 1p coins differed by only one, and the total value was again an exact number of pounds. In fact, this total value was the same as for the Saturn Skyjacker.
Incredibly, the same was true for coins from the Aries Axeman: the numbers of 5p and 2p coins differed by one, and the total value was the same as for the Mars Marauder and the Saturn Skyjacker.
What was the total number of coins I emptied that day?
This puzzle is included in the book The Sunday Times Book of Brainteasers (1994).
[teaser1087]
Jim Randell 11:13 am on 25 January 2024 Permalink |
The value of a word is formed by concatenating the values (in base 10) of the digits, and then reading the result as a number.
So, for example, if O = 10, N = 6, E = 25, then the value of ONE is 10625 (= 10:6:25).
The following run file executes in 229ms. (Internal runtime of the generated program is 73ms).
Run: [ @replit ]
Solution: TWO = 4232.
There are two assignments that achieve this:
And if we allow leading zeros (i.e. O or T is 0), we can also have:
So perhaps the puzzle would have been better if the values used were 1 to 26.
LikeLike
GeoffR 3:00 pm on 25 January 2024 Permalink |
from math import isqrt def is_sq(x): return isqrt(x) ** 2 == x for O in range(1, 27): for N in range(26): if N == O: continue for E in range(26): if E in (O, N): continue #1. ONE is a perfect square. ONE = int(str(O) + str(N) + str(E)) if is_sq(ONE): for T in range(1, 27): if T in (O, N, E): continue for W in range(26): if W in (T, O, N, E): continue #2. ONE + ONE = TWO TWO = int(str(T) + str(W) + str(O)) if ONE + ONE == TWO: print(f"ONE = {ONE} and TWO = {TWO}") print(f"O={O}, N={N}, E={E}, T={T}, W={W}") print() # ONE = 2116 and TWO = 4232 # O=2, N=1, E=16, T=4, W=23 # ONE = 2116 and TWO = 4232 # O=2, N=11, E=6, T=4, W=23LikeLike
Frits 4:50 am on 26 January 2024 Permalink |
from itertools import permutations from enigma import is_square sols = set() # O has to be even as 2 * ONE = TWO for O in range(2, 26, 2): lnO = 1 + (O > 9) for N, E in permutations([n for n in range(26) if n != O], 2): if not is_square(ONE := int(str(O) + str(N) + str(E))): continue # parse TWO into TW and O_ (sTW, sO_) = ((sTWO := str(ONE + ONE))[:-lnO], sTWO[-lnO:]) if sO_ != str(O): continue # parse TW into T and W for t in range(1 + (len(sTW) == 4), 2 + (len(sTW) > 2)): (T, W) = (int(sTW[:t]), int(sTW[t:])) # different numbers if T == W or any(n in {O, N, E} or n > 25 for n in [T, W]): continue sols.add(sTWO) print(f"answer: {' or '.join(sols)}")LikeLike