From The Sunday Times, 1st October 1978 [link]

Margaret was demonstrating the use of a pocket calculator to her grandfather. (Keyboard shown above). It was of the type having algebraic logic, which does continuous mixed calculations (e.g. 5 + 2 × 3 = 21). She also demonstrated that keying two consecutive operations results in the second taking preference (e.g. 5 +× 2 = 10).
Margaret asked grandfather to calculate 80 × 5 + 40 − 10; but unfortunately grandfather’s hands were a little shaky and he was prone to strike keys horizontally oг vertically adjacent to the correct one.
Having entered the sum grandfather was about to press the = key (fortunately he hadn’t pressed it before) when Margaret stopped him.
“You have made just two errors so far, and they were consecutive”, she said, “but don’t worry, if you divide by your age on your next birthday, then press the = key, you will get the correct answer to the calculation”.
Grandfather completed the calculation and correctly pressed the = key.
“Wrong again”, said Margaret, “interesting answer though — if you deduct grandmother’s age, and take the cube root of the remainder, you will get the sum of your age, and mine, on our last birthdays”.
How old are Margaret, grandmother and grandfather?
Another early calculator-based puzzle.
This puzzle is included in the book The Sunday Times Book of Brain-Teasers: Book 2 (1981). The puzzle text above is taken from the book.
[teaser895]
Jim Randell 7:02 am on 20 September 2026 Permalink |
This is similar to Routh’s Theorem, but with a square instead of a triangle. (See: Teaser 2444, Teaser 3021).
If the distances along the top are a (a 2-digit number) and b (a 3-digit number), then:
And the area of the central paddock A (as a fraction of the entire square) is given by:
So we are looking for coprime values for a and b, such that (a² + (a + b)²) is a fourth power.
Since a is a 2-digit number and b a 3-digit number the fourth power must be in the range [12200..1215405], i.e. [114..334].
The following Python program considers possible fourth powers for the denominator (q) and then looks for squares that sum to this number to determine a and b.
It runs in 71ms. (Internal runtime is 1.3ms).
from enigma import (irange, sum_of_squares, gcd, printf) # consider possible 4th powers for the denominator for n in irange(11, 33): q = n**4 # split q into the sum of two squares (= a^2 + (a + b)^2) for (a, c) in sum_of_squares(q, 2, min_v=10): if a > 99: break b = c - a if b < 100 or b > 999 or gcd(a, b) > 1: continue # output solution printf("a={a} b={b} -> A = {p}/{q} = {b}^2/{n}^4", p=b*b)Note that the program finds the (unique) solution where the formula for the area given above results directly in a fraction of the form x2 / y4. (Which is what I expect the setter is after).
However it is not the only solution that can be expressed as a fraction of the form x2 / y4.
Solution: [To Be Revealed]
LikeLike
Jim Randell 2:16 pm on 20 September 2026 Permalink |
Assuming that the fractional area, when expressed as a fraction in lowest terms, is of the form x2 / y4, then the solution is unique.
A straightforward approach finds the solution in an acceptable time. (Internal runtime is 131ms):
from enigma import (irange, gcd, cproduct, fraction, is_square, is_power, printf) # consider co-prime a (2-digit) and b (3-digit) values for (a, b) in cproduct([irange(10, 99), irange(100, 999)]): if gcd(a, b) > 1: continue # calculate the fraction (in lowest terms) (p, q) = fraction(b*b, a*a + (a + b)*(a + b)) # is it of the form x^2 / y^4 ? (x, y) = (is_square(p), is_power(q, 4)) if x is None or y is None: continue # output solution printf("a={a} b={b} -> A = {p}/{q} = {x}^2/{y}^4")But we can also use a bit of analysis to adapt my original program:
In the formula (for coprime a, b):
If b is odd, then the formula is already in lowest terms, so we just need to check that the denominator is a fourth power.
If b is even, then the numerator and denominator in the formula can be reduced by dividing by 2 exactly once. But this leaves a numerator that can never be reduced to a perfect square.
So all we need to do is reject even b values:
from enigma import (irange, sum_of_squares, gcd, printf) # consider possible 4th powers for the denominator for n in irange(11, 33): q = n**4 # split q into the sum of two squares (= a^2 + (a + b)^2) for (a, c) in sum_of_squares(q, 2, min_v=10, sep=11): if a > 99: break b = c - a if b < 100 or b > 999 or b % 2 == 0 or gcd(a, b) > 1: continue # output solution printf("a={a} b={b} -> A = {p}/{q} = {b}^2/{n}^4", p=b*b)LikeLike
Frits 4:34 pm on 21 September 2026 Permalink |
Using Euclid’s formula (something that was mentioned lately in an internal discussion).
from enigma import (gcd, printf) def pythagorean_triples_exact(num, min_v=10): # solve: a^2 + b^2 = c^2 where num = c^2 using Euclid's formula for m in range(2, num + 1): m2 = m * m # "... not both odd..." for n in range(1 + m % 2, m, 2): # "... with m and n coprime ..." if gcd(m, n) == 1: n2 = n * n c = m2 + n2 if c > num: break a = m2 - n2 b = 2 * m * n if b < a: a, b = b, a k, r = divmod(num, c) if not r: if a * k >= min_v: yield (a * k, b * k) # consider possible 4th powers for the denominator for n in range(11, 34): q2 = n * n # split q2 * q2 into the sum of two squares (= a^2 + (a + b)^2) for (a, c) in pythagorean_triples_exact(q2, min_v=10): if a > 99: continue b = c - a if b < 100 or b > 999 or b % 2 == 0 or gcd(a, b) > 1: continue # output solution printf("a={a} b={b} -> A = {p}/{q4} = {b}^2/{n}^4", p=b*b, q4=q2*q2)LikeLike
Frits 1:30 pm on 20 September 2026 Permalink |
The program runs reasonably fast under PyPy.
Weak spot is the upper limit for “q” and the assumption that the fraction is minimal (numerator and denominator are broken down as much as possible).
from math import gcd is_square = lambda n: None if (rt := round(n**.5))**2 != n else rt # small and larger distances for x in range(10, 100): x2, x4 = x * x, x * x * x * x for y in range(100, 1000): if gcd(x, y) > 1: continue # consider the smallest triangle with it's angle <t> # sin(t)^2 = b^2 / x^2 = x^2 / (2x^2 + 2xy + y^2) b2 = x4 / ((2 * x2 + (xy2 := 2 * x * y) + (y2 := y**2))) # calculate the sides of the small triangle a = (x2 - b2)**.5 b = b2**.5 # C^2 is the area of the central paddock c2 = y2 - x2 + 2 * a * b # area of the central paddock divided by the area of the field f = c2 / (x2 + xy2 + y2) # can we write f as p^2 / q^4 for q in range(1, 100): p2 = f * q**4 # is p2 an integer? if abs(p2 - round(p2)) < 1e-13: p2 = round(p2) if gcd(p2, q) == 1 and (p := is_square(p2)): print(f"answer: {x} and {y}") breakLikeLike