Brain Teaser: The cottage
From The Sunday Times, 23rd December 1956 [link]
A man sold his country cottage, receiving the proceeds in £5 notes, and decided to divide the money among his four sons. He first changed the money Into £1 notes. “To you, Arthur”, he said, “I will give one-quarter. You, Bernard, will take one-quarter of the remainder. Charles can have one-quarter of what is left, and David one-fourth of the rest. You will then each take one-quarter of the remainder”.
It was found that before each successive sum could be divided exactly by four, it was necessary to remove one pound note, which the father put in his pocket £5 in all.
How much did the cottage realise?
This is one of the occasional Holiday Brain Teasers published in The Sunday Times prior to the start of numbered Teasers in 1961.
[teaser-1956-12-23] [teaser-unnumbered]
Jim Randell 8:58 am on 5 December 2021 Permalink |
This is a “monkey and coconuts” problem (see: Enigma 258, Puzzle #86).
This program finds the first few possible solutions. The first of these is the only one that gives a viable price for the cottage (according to the published solution).
Run: [ @replit ]
from enigma import (irange, inf, div, arg, printf) def solve(): # consider selling price of the cottage for x in irange(5, inf, step=5): t = x # A's amount t -= 1 A = div(t, 4) if A is None: continue # B's amount t -= A + 1 B = div(t, 4) if B is None: continue # C's amount t -= B + 1 C = div(t, 4) if C is None: continue # D's amount t -= C + 1 D = div(t, 4) if D is None: continue # and each gets 1/4 of what is left t -= D + 1 q = div(t, 4) if q is None: continue yield (x, A + q, B + q, C + q, D + q) # find the first few solutions n = arg(1, 0, int, "number of solutions to find") for (i, (x, A, B, C, D)) in enumerate(solve(), start=1): printf("[{i}] x={x}; A={A} B={B} C={C} D={D}") if i == n: breakSolution: The value of the cottage was £2045.
The father keeps £5 and the split of the remaining £2040 is: A=672, B=544, C=448, D=376.
LikeLike
Jim Randell 9:37 am on 5 December 2021 Permalink |
Using this analysis [@wolfram] we see that the solutions to the problem are given by:
for k = 1, 2, 3, … where N is a multiple of 5.
And we can write a more efficient program:
from enigma import (irange, inf, ediv, arg, printf) def solve(): for k in irange(1, inf): x = 1024 * k - 3 if x % 5 != 0: continue # calculate amounts t = x - 1 A = ediv(t, 4) t -= A + 1 B = ediv(t, 4) t -= B + 1 C = ediv(t, 4) t -= C + 1 D = ediv(t, 4) t -= D + 1 q = ediv(t, 4) yield (x, A + q, B + q, C + q, D + q) # find the first few solutions n = arg(1, 0, int, "number of solutions to find") for (i, (x, A, B, C, D)) in enumerate(solve(), start=1): printf("[{i}] x={x}; A={A} B={B} C={C} D={D}") if i == n: breakLikeLike