Brain Teaser: What’s his number?
From The Sunday Times, 20th December 1959 [link]
A professor of mathematics was driving in an unfamiliar transatlantic city to visit a friend who lived in a very long street. Stopping to check the street-name he found he had entered the street he was looking for at the end where the high numbers finished. The final number started a train of thought: after a short calculation he smiled in satisfaction and drove on to his friend’s house.
His friend was astonished when he said: “I have just discovered a most curious thing: did you know that, in this street, the sum of the house-numbers larger than your number is equal to the sum of the house-numbers smaller than your number?”
Given that the street contained between 500 and 3,500 houses, how many houses were there in it and what was the number of the friend’s house?
This is one of the occasional Holiday Brain Teasers published in The Sunday Times prior to the start of numbered Teasers in 1961. A prize of 3 guineas was offered.
[teaser-1959-12-20] [teaser-unnumbered]







Jim Randell 9:06 am on 3 October 2021 Permalink |
(See also: Enigma 1725).
We assume the houses are numbered consecutively from 1 without duplication or omission.
If the friend’s house is x of y, we have:
And y is in the range 500 to 3500.
We can easily solve this programatically. The following short Python program runs in 53ms.
Run: [ @replit ]
from enigma import (irange, tri, is_square, printf) for y in irange(500, 3500): x = is_square(tri(y)) if x: printf("house {x} of {y}")Solution: There were 1681 houses in the street. The friend’s house was number 1189.
Manually, we need to find a triangular number that is also a square number (and in a specific range).
A recurrence relation for the square triangular numbers [@wikipedia] is:
and if: N[k] = (s[k])² = T[t[k]], we have:
Calculating these sequences we see:
Only the values for k = 5 are in the required range, so:
We can implement these steps programatically as follows:
from enigma import (fib, unpack, printf) S = fib(0, 1, fn=unpack(lambda a, b: 6 * b - a)) T = fib(0, 1, fn=unpack(lambda a, b: 6 * b - a + 2)) for (k, (s, t)) in enumerate(zip(S, T)): f = (499 < t < 3501) printf("s[{k}] = {s}; t[{k}] = {t} {f}", f=['', '[*** SOLUTION ***]'][f]) if t > 3500: breakAs these sequences increase t[k] / s[k] gives rational approximations to √2. In the case of the solution we have:
LikeLike
John Crabtree 2:55 pm on 5 October 2021 Permalink |
Fortunately for manual solvers this brain teaser is accessible via the Pell equation, ie
(2y + 1)^2 – 2(2x)^2 = 1
where (2y + 1)/(2x) are rational approximations to √2.
Letting a = 2x and b = 2y + 1 leads to
a[0] = 0, b[0] = 1, x[0] = 0, y[0] = 0
a[1] = 2, b[1] = 3, x[1] = 0, y[1] = 1
a[2] = 12, b[2] = 17, x[2] = 6, y[2] = 8
a[k + 2] = 6 a[k + 1] – a[k]
b[k + 2] = 6 b[k + 1] – b[k]
Then one needs to calculate three more (a, b) pairs so that y is in the permitted range.
My guess is that this was the first appearance of the Pell equation in a ST Brain Teaser.
LikeLike
GeoffR 6:36 pm on 7 October 2021 Permalink |
I programmed this teaser as the arithmetic sum of the house numbers left (smaller) and right (larger) than my friend’s house number.
LikeLike
GeoffR 8:53 am on 8 October 2021 Permalink |
A short Python programme verified the answer.
# check sums of lower and higher house numbers for his number (1189) from enigma import irange lower_sum, higher_sum = 0, 0 # sum of numbers lower than his number for n in irange(1, 1188): lower_sum += n # sum of numbers higher than his number for m in irange(1190, 1681): higher_sum += m print(f"Lower sum = {lower_sum}, Higher sum = {higher_sum}") # Lower sum = 706266, Higher sum = 706266LikeLike