From The Sunday Times, 6th June 1971 [link]
There were six. Messrs. Butcher, Carpenter, Draper, Farmer, Grocer and Miller, who shared the fire-watching on Friday nights — three this week, three the next. By occupation they were (not necessarily respectively) a butcher, a carpenter, a draper, a farmer, a grocer and a miller.
Incidents were few and far between, until that Saturday morning when they found the “log” book signed by the Acting Deputy Assistant something or other, as follows: “All three present and fast asleep”.
Something had to be done about it: they decided to watch, to play whist, and to keep awake in the future. It was arranged thus: four did duty this week, next week two stood down and two others came in, and so on. Each did two turns in three weeks.
On the first Friday the carpenter, the draper, the farmer and the miller watched. Next week Mr Carpenter, Mr Draper, Mr Farmer and Mr Grocer played. On the third occasion Mr Butcher played against Mr Grocer, Mr Farmer against the butcher, and the miller against the draper. Each night the four cut for partners and kept them till morning.
If Mr Carpenter’s occupation is the same as the name of the one whose occupation is the same as the name of the one whose occupation is the same as the one whose occupation is the same as the name of the miller:
What is Mr Miller’s occupation?
As presented this puzzle has no solutions. In the comments I give a revised version that does have a unique answer.
This puzzle was originally published with no title.
[teaser521]
Jim Randell 8:58 am on 23 June 2020 Permalink |
My first thought was to generate integers that start with a 3, and then check to see if they make a “sandwich box”. But this was taking a long time, so here’s some analysis to produce a faster program:
If f is an n digit “filling” number, then the corresponding sandwich numbers in a sandwich box are:
for b = 1 .. 9. And each of these must be divisible by f.
Clearly f will divide the 10.f part, which leaves b(10^(n + 1) + 1), when b = 1, we must have f divides (10^(n + 1) + 1), and if this is the case f will divide the remaining sandwich numbers with b > 1.
So, f must be a divisor of (10^(n + 1) + 1), and we are looking for the smallest f that starts with a 3.
and f is an n digit number that starts with 3, so g = 26 .. 33.
This Python program runs in 49ms. (Internal runtime is 46µs).
Run: [ @replit ]
from enigma import (irange, inf, printf) def solve(): # consider n digit fillings x = 101 for n in irange(1, inf): # f is an n digit divisor of x for g in irange(33, 26, step=-1): (f, r) = divmod(x, g) if r == 0: yield f x *= 10 x -= 9 for f in solve(): printf("f = {f}") breakSolution: The smallest filling beginning with 3 is: f = 3448275862069.
Where: 29f = 10^14 + 1.
So we see why the simple program was taking so long. (In the end it took 32 minutes).
In fact there is a family of filling numbers that start with 3 that take the form:
where the section in brackets can be included 0 or more times, to give fillings with length (13 + 28k) digits.
We can adapt the program to generate all filling numbers without the restriction that the leading digit is 3.
from enigma import (irange, inf, match, printf) # generate "filling" numbers def filling(): # consider n digit fillings x = 101 for n in irange(1, inf): # f is an n digit divisor of x M = x // 10 for g in irange(101, 11, step=-1): (f, r) = divmod(x, g) if r == 0 and f < M <= 10 * f: yield f x *= 10 x -= 9 for f in filling(): printf("f = {f}") if match(f, '3*'): breakSee: OIES A116436 [ @oeis.org ]
LikeLike