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 5:24 pm on 17 March 2023 Permalink |
I think it is necessary to assume that the elephant did not return to its original position. (i.e. “some of them” is interpreted as “some (but not all) of them”).
So we suppose that we start off with a see-saw of length 2d and a unit weight acrobats on one end (a is a prime number, less than 20). They are balanced by an elephant of weight a on the other end.
The elephant then moves forwards (towards the pivot) p feet (p is a prime number), and some of the acrobats jump off, leaving b acrobats balancing the elephant (b is a prime number, less than a):
The elephant then moves backwards (away from the pivot) q feet (q is a prime number, less than p), and some of the acrobats remount to make c acrobats balancing the elephant (c is a prime number, between b and a):
From these two equations we can determine p in terms of q and a, b, c:
There are only a certain number (a, b, c) values, so we can look at possible values for q, and see if there is only a single set of (a, b, c) values that give a viable value of p.
This Python program runs in 62ms. (Internal runtime is 285µs).
Run: [ @replit ]
from enigma import (primes, subsets, div, inf, fdiv, printf) # collect possible (a, b, c) numbers of acrobats abcs = list((a, b, c) for (b, c, a) in subsets(primes.between(2, 20), size=3)) # consider the distance the elephant moves back = q for q in primes.irange(2, inf): # find viable p values ps = list() for (a, b, c) in abcs: p = div(q * (a - b), c - b) if p and p > q and p in primes: ps.append((a, b, c, p)) if len(ps) == 1: (a, b, c, p) = ps[0] printf("q={q} -> a={a} b={b} c={c} p={p}; d={d:g}", d=fdiv(a * q, c - b)) breakSolution: The elephant moved backwards 11 ft. There are 19 acrobats in the troupe.
The see-saw is 19 feet either side of the pivot (i.e. end to end length is 38 feet).
And initially there are 19 acrobats on one end, balanced by an elephant that weighs the same as 19 acrobats on the other end.
The elephant moves forward by 17 ft, so it is 2 ft from the pivot, and this is balanced by 2 acrobats 19 ft from the pivot (19 × 2 = 2 × 19).
The elephant then moves backwards by 11 ft, so it is 13 ft from the pivot. And this is balanced by 13 acrobats 19 ft from the pivot (19 × 13 = 13 × 19).
There are 16 candidate solutions.
So the answer is found from q = 11.
LikeLike
Jim Randell 11:53 am on 18 March 2023 Permalink |
Even shorter (and exhaustive):
and both p and q are primes, so can be determined from their ratio.
Run: [ @replit ]
from enigma import (primes, subsets, fraction, filter_unique, item, fdiv, printf) # generate candidates (p, q, a, b, c) def candidates(): for (b, c, a) in subsets(primes.between(2, 20), size=3): (q, p) = fraction(c - b, a - b) if primes.is_prime(q) and primes.is_prime(p): yield (p, q, a, b, c) # find solutions unique by q (= item 1) for (p, q, a, b, c) in filter_unique(candidates(), item(1)).unique: printf("q={q} -> a={a} b={b} c={c} p={p}; d={d:g}", d=fdiv(a * q, c - b))LikeLike
Jim Randell 8:27 am on 18 March 2023 Permalink |
@GeoffR: I think 5 is also a prime.
And there are additional candidate solutions where the length of the see-saw is not an even integer number of feet. But the length of the see-saw can be eliminated from the equations to keep the remaining variables integers. (Although it would be possible to also specify the see-saw length as an integer number of inches).
LikeLike
GeoffR 10:00 am on 18 March 2023 Permalink |
from itertools import permutations from enigma import is_prime from collections import defaultdict nums = defaultdict(list) primes = (2, 3, 5, 7, 11, 13, 17, 19) for acrobats in permutations(primes, 3): # A1 = full acrobat troupe # A2 = acrobats after elephant moves forward # A3 = acrobats after elephant then moves backwards A1, A2, A3 = acrobats if A1 > A2 and A1 > A3 and A2 < A3: # for intial balancing of elephant v. troupe # elephants weight = weight of acrobat troupe E = A1 # assume max. half seesaw length = 25 ft. for dist in permutations(range(1, 26), 3): half_see_saw, p1, p2 = dist if p2 < p1 and is_prime(p1) and is_prime(p2): # Taking moments about centre pivot if (half_see_saw - p1) * E == half_see_saw * A2: if (half_see_saw - p1 + p2) * E == half_see_saw * A3: # index dictionary on distance elephant moved backwards nums[p2] += [(p1, p2, A1, A2, A3)] # find a single solution for k,v in nums.items(): if len(v) == 1: print(f"Distance elephant moves backward = {k} ft.") print(f"Number of acrobats in troupe = {v[0][2]}.")LikeLike