From The Sunday Times, 26th February 1961 [link]
“We’re a biggish family in more ways than one”, said Jeremy. “Five, including triplets, and three of us the same height. I’m 6 ft. and aged 72; Jim is three inches taller than John and three years older; and John and Julian’s combined heights are 5 ft. 11 in. more than Joe’s and their combined ages 71 years more than his. Our aggregate height in inches equals our aggregate age in years, but no one’s age in years equals Joe’s height in inches”.
What were the name, age and height of the tallest of the triplets?
This was the first of the regular Teaser puzzles published in The Sunday Times. It was accompanied by the following introduction:
Brain-Teasers: a Weekly Feature
Great numbers of our readers have found entertainment and interest in the Brain-Teasers, or mathematical problems, which we have published from time to time, usually at holiday week-ends. Now we intend to make them a weekly feature of The Sunday Times.
Readers themselves have supplied many of the best of the problems in the past, and we invite them to continue to do so. A fee of £10 will be paid for each problem accepted.
Problems should fulfil the following conditions: Both the problem and the solution must be expressible in reasonably brief compass. No advanced or specialist mathematical techniques should be necessary. Solutions should be unique, or otherwise admit of no uncertainty in judging. Problems must be original. Diagrams are admissible if they are not too complicated.
The problem below is the invention of a reader who observes: “Any who are stumped by it after the expiry of an hour should feel cause for concern”.
A prize of £3 was offered.
[teaser1]
Jim Randell 5:08 pm on 24 July 2020 Permalink |
It is straightforward to implement this directly.
The following Python program runs in 52ms.
Run: [ @replit ]
from enigma import (powers, int2base, printf) # consider 4-digit squares, where 4n is a 5-digit number for n in powers(50, 99, 2): # what is n in base 7? n7 = int2base(n, base=7) # which if interpreted in base 10 is 4n if int2base(4 * n) == n7: printf("n={n} [= {n7} (base 7)]")Solution: The four digit number is: 2601.
2601 = 51², so the answer is found on the second number tested by the program.
4×2601 = 10404, and 10404 (base 7) = 2601 (base 10).
Or, as a single Python expression:
LikeLike
Jim Randell 4:40 pm on 30 July 2020 Permalink |
Or, using the [[
SubstitutedExpression()]] solver from the enigma.py library:Run: [ @replit ]
LikeLike
GeoffR 7:54 am on 26 July 2020 Permalink |
% A Solution in MiniZinc include "globals.mzn"; % digits for 4 digit number to base 10 var 1..9:A; var 0..9:B; var 0..9:C; var 0..9:D; var 1000..9999: ABCD = 1000*A + 100*B + 10*C + D; % digits for 5 digit number in base 7 var 1..6:E; var 0..6:F; var 0..6:G; var 0..6:H; var 0..6:I; var 10000..99999: EFGHI = 10000*E + 1000*F + 100*G + 10*H + I; predicate is_sq(var int: y) = let { var 1..ceil(sqrt(int2float(ub(y)))): z } in z*z = y; % 5-digit number is four times the 4-digit number constraint 4 * ABCD == EFGHI; % Both 4-digit and 5-digit numbers are squares constraint is_sq(ABCD) /\ is_sq(EFGHI); % ABCD (base 10) = EFGHI (base 7) constraint ABCD == I + 7*H + 7*7*G + 7*7*7*F + 7*7*7*7*E; solve satisfy; output [ "Four digit number (base 10) is " ++ show(ABCD) ++ "\nFive digit number (base 7) is "++ show(EFGHI) ];LikeLike
GeoffR 8:20 pm on 27 July 2020 Permalink |
from enigma import is_square, nsplit for n in range(50,100): if is_square(n*n): N4 = n*n # 4-digit number (base 10) N5 = 4*n*n # 5-digit number (base 7) # split 5-digit number N5 into digits a, b, c, d, e = nsplit(N5) # check N4 = N5 in specified bases if N4 == e + d*7 + c*7**2 + b*7**3 + a*7**4: print(f"4-digit number(base 10)= {n**2}") print(f"5-digit number(base 7)= {4*n**2}")LikeLike
GeoffR 8:07 am on 28 July 2020 Permalink |
I have updated my programme to include a check that the digits (7,8,9) are not included in the 5-digit number before it is converted to base 7. In practice, the answer is found very early.
from enigma import is_square, nsplit for n in range(50, 100): if is_square(n * n): N4 = n * n # 4-digit number (base 10) N5 = 4 * n * n # 5-digit number (base 7) # split 5-digit number N5 into digits a, b, c, d, e = nsplit(N5) # check digits 7,8,9 are not in N5, base 7 if any(x in (a,b,c,d,e) for x in (7,8,9)): continue # check N4 = N5 in specified bases if N4 == e + d*7 + c*7**2 + b*7**3 + a*7**4: print(f"4-digit number(base 10)= {n**2}") print(f"5-digit number(base 7)= {4*n**2}")LikeLike
Jim Randell 2:53 pm on 29 July 2020 Permalink |
@GeoffR: That’s why in my code I interpret a base 7 representation as base 10. There is no need to check for invalid digits, as every base 7 digit is a valid base 10 digit.
LikeLike