# Solution to "A Long Street"

A solution for mere mortals would run something like this:-
Let N be the total number of houses in the street.
Let n be the number of the friend's house.
Using the standard formula for the sum of an arithmetic progression
The sum of the houses below n is n*(n-1)/2
The sum of the houses above n is (N-n)*(N+n+1)/2
Equating and simplifying gives

n2 = N (N+1)/2

Replace N by (p-1)/2 and n by q/2 gives

p2 - 2 q2 = 1

Equations of this type are called 'Pell Equations' and have a text book solution in terms of continued fractions, which is presumably how Ramanujan reached his solution. They have an infinite number of solutions in integers but fortunately in this case there is an obvious solution in small numbers, p = 3, q = 2. Many puzzlers will know the simple formula from which extra solutions can be calculated from one initial solution. If (a,b) and (c,d) are solutions to

p2 - W q2 = 1

then (ac + Wbd, ad + bc) is also a solution. And if you have only one initial solution you can use it twice. In this case (remembering that W = 2)
we use a=c=3, b=d=2 to give a second solution, p = 17, q = 12 and
{a=3,b=2,c=17,d=12} gives a third one, p = 99, q = 70. Finally,
{a=3,b=2,c=99,d=70} gives a fourth solution, p = 577, q = 408.
Translating these solutions back to the original variables we get

pqfriend's housetotal houses
171268
99703549
577408204288

The first two answers meet the condition on house numbers but not the total number of houses in the street. The last is the required answer.

Back to Dick's Math Puzzle Page