From The Sunday Times, 25th May 1980 [link]
Large families often have problems, particularly when it comes to deciding who has first choice, etc.
My six brothers and I solved this particular one by devising our own dice game. Each of us in turn would roll a die four times and put the results together in that order to form a four-figure number. (So that, for example: 6 followed by 2, then 3 and 1, gives the number 6231). We would each do this and the one of us getting the highest four-figure number would be declared the winner.
One such game had some very strange results. Each of us got a different prime number, using the same four different digits. The average of the seven primes was a perfect square, to which Jon’s number was the nearest.
The difference between Ron’s and Don’s numbers, multiplied by one of the numbers from the die, gave the difference between Len’s and Ken’s numbers.
Omitting Ben’s score, the total could have been formed by throwing the die five times. And so could the total of the numbers thrown by Len, Ken, Ron and me.
What was my score, and who ate the biggest piece of apple pie?
The originally published version of this puzzle was flawed, so the version above was taken from the book Microteasers (1986), in which it was noted:
There is an interesting postscript to [this] puzzle. When it first appeared, the condition “each of us got a different prime number using the same four different digits” was given as “each of us got a different prime number; two digits never came up”. That allowed numbers like 5651, which was not the intention at all. The odd thing is that all the readers who sent in answers found the intended solution anyway. So perhaps, even if one relaxes the condition about all the primes using four different digits, the teaser still has a unique solution. The keener reader might like to adapt the program to take four digits in turn and see how many primes can be made from those four (but not necessarily using all four each time). Then you have to consider all possible sets of seven from those. We leave this much harder problem as an exercise.
However the original formulation of the puzzle does not give a unique solution.
[teaser931]
Jim Randell 11:57 am on 23 April 2023 Permalink |
This Python program uses the [[
SubstitutedExpression()]] solver from the enigma.py library to see if there are solutions to the alphametic expressions.It runs in 85ms.
Run: [ @replit ]
from enigma import (SubstitutedExpression, subsets, sprintf, printf) # does an alphametic sum have answers? solve = lambda expr: any(SubstitutedExpression([expr]).solve(verbose=0)) # expressions involving words for 1, 2, 3, 4 exprs = [ "{w1} + {w1} = {w2}", "{w1} + {w2} = {w3}", "{w1} + {w3} = {w4}", "{w2} + {w2} = {w4}", "{w1} + {w4} == {w2} + {w3}", ] # allocate the words for (w1, w2, w3, w4) in subsets(["AA", "BA", "EB", "DE"], size=4, select='P'): # are all the expressions solvable? if all(solve(sprintf(x)) for x in exprs): # output solution printf("1 = {w1}; 2 = {w2}; 3 = {w3}; 4 = {w4}")Solution: 1 = DE; 2 = BA; 3 = AA; 4 = EB.
So we have:
LikeLike
Frits 5:10 pm on 23 April 2023 Permalink |
from enigma import subsets ''' 0: ab + ab = ef reject if: b in {a, f}, e = f, 1: ab + cd = ef reject if: b = f and d in {a, e}, d = f and b in {c, e} e = f and (b = c or a = d) 2: ab + cd = ef + gh reject if not: b = d or f = h ''' # reject words depending on the type of equation def rej(t, w, x, y, z=0): (a, b) = (w[0], w[1]) (c, d) = (x[0], x[1]) (e, f) = (y[0], y[1]) if t == 0 and (e == f or b in {a, f}): return True if t == 1 and any([b == f and d in {a, e}, d == f and b in {c, e}, e == f and (b == c or a == d)]): return True if t == 2 and not (b == d or f == z[1]): return True return False # allocate the words for (w1, w2, w3, w4) in subsets(["AA", "BA", "EB", "DE"], size=4, select='P'): if rej(0, w1, w1, w2): continue if rej(1, w1, w2, w3): continue if rej(1, w1, w3, w4): continue if rej(0, w2, w2, w4): continue if rej(2, w1, w4, w2, w3): continue print(*zip(range(1, 5), (w1, w2, w3, w4)))LikeLike
Frits 5:23 pm on 23 April 2023 Permalink |
This is more of a program saying: “if there is a solution it must be one of these: ….”
LikeLike