30

The wikipedia entry on Ramanujan contains the following passage:

One of his remarkable capabilities was the rapid solution for problems. He was sharing a room with P. C. Mahalanobis who had a problem,

Imagine that you are on a street with houses marked $1$ through $n$. There is a house in between $(x)$ such that the sum of the house numbers to left of it equals the sum of the house numbers to its right. If $n$ is between $50$ and $500$, what are $n$ and $x$?

This is a bivariate problem with multiple solutions. Ramanujan thought about it and gave the answer with a twist: He gave a continued fraction. The unusual part was that it was the solution to the whole class of problems. Mahalanobis was astounded and asked how he did it. "It is simple. The minute I heard the problem, I knew that the answer was a continued fraction. Which continued fraction, I asked myself. Then the answer came to my mind," Ramanujan replied.

What was the continued fraction, and how did it give all solutions to the problem? Most importantly, how could someone derive such a solution? Do similar problems also have continued fractions that describe all solutions?

This seems like an interesting and powerful method, and I would like to learn more about it.

Blue
  • 69,412
  • 11
  • 108
  • 217
Potato
  • 37,797
  • 15
  • 117
  • 251
  • 13
    The problem reduces to a Pell equation whose solutions can be obtained from the continued fraction expansion of $\sqrt{2}$. – André Nicolas May 19 '12 at 20:32

4 Answers4

15

An expansion of Andre's comment into a detailed exposition can be found at http://www.johnderbyshire.com/Opinions/Diaries/Puzzles/2009-06.html. It's also at http://www.angelfire.com/ak/ashoksandhya/winners2.html#PUZZANS4.

Gerry Myerson
  • 168,500
  • 12
  • 196
  • 359
  • 1
    See also http://www.math.auckland.ac.nz/~butcher/miniature/miniature2.pdf an article by John Butcher, where he guesses that Ramanujan was thinking of a (more general type of) continued fraction namely $$3 - \cfrac{1}{6 - \cfrac{1}{6 - \cfrac{1}{6 - \dots}}}$$. – ShreevatsaR Dec 13 '12 at 10:00
7

We will use

Theorem 1: If $r\gt0$ is irrational and $\left|\,\frac pq-r\,\right|\le\frac1{2q^2}$ where $(p,q)=1$, then $\frac pq$ is a continued fraction convergent for $r$.

and

Theorem 2: If $\left\{\frac{p_k}{q_k}\right\}$ is the sequence of continued fraction convergents for an irrational $r\gt0$, then $r$ is between $\frac{p_k}{q_k}$ and $\frac{p_{k+1}}{q_{k+1}}$ and $\frac{p_{k+1}}{q_{k+1}}-\frac{p_k}{q_k}=\frac{(-1)^k}{q_{k+1}q_k}$.


The problem can be written as $$ \overbrace{\ \frac{x^2-x}2\ }^{\substack{\text{sum of $1$}\\\text{to $x-1$}}}=\overbrace{\frac{n^2+n}2-\frac{x^2+x}2}^\text{sum of $x+1$ to $n$}\tag1 $$ which is equivalent to $$ 8x^2=(2n+1)^2-1\tag2 $$ From $(2)$, we get $\frac{2n+1}x=\sqrt{8+\frac1{x^2}}$; thus, we want an over-estimate for $\sqrt8$ that has an odd numerator. Furthermore, $(2)$ implies $$ \begin{align} \frac{2n+1}x-\sqrt8 &=\sqrt{8+\tfrac1{x^2}}-\sqrt8\\[9pt] &=\frac{1/x^2}{\sqrt{8+\frac1{x^2}}+\sqrt8}\\ &\le\frac1{2\sqrt8\,x^2}\tag3 \end{align} $$ Theorem 1 and inequality $(3)$ say that $\frac{2n+1}x$ needs to be a continued fraction approximant for $\sqrt8$ to satisfy $(2)$.

The continued fraction for $\sqrt8$ is $(2;1,4,1,4,1,\dots)$. The convergents are $$ \begin{array}{c|cc} k&0&\color{#C00}{1}&2&\color{#C00}{3}&4&\color{#C00}{5}&\dots\\\hline \frac{p_k}{q_k}&\frac21&\color{#C00}{\frac31}&\frac{14}5&\color{#C00}{\frac{17}6}&\frac{82}{29}&\color{#C00}{\frac{99}{35}}&\dots \end{array}\tag4 $$ The repeating continued fraction gives the following numerator/denominator recurrence $$ \begin{align} a_{2n}&=4a_{2n-1}+a_{2n-2}\tag{5a}\\ a_{2n+1}&=a_{2n}+a_{2n-1}\tag{5b} \end{align} $$ Theorem 2 says that the red terms, the ones with odd indices, are over-estimates. Furthermore, the recurrences $\text{(5a)}$ and $\text{(5b)}$ guarantee that the red terms have odd numerators.

Combining $\text{(5a)}$ and $\text{(5b)}$, we get that the recurrence for the odd numbered numerators and denominators is $$ a_{2n+1}=6a_{2n-1}-a_{2n-3}\tag6 $$ Thus, we can get the solutions from the odd-indexed terms of $(4)$: $$ \begin{array}{c|cc} k&1&3&5&7&9&\dots\\\hline \frac{p_k}{q_k}&\frac31&\frac{17}6&\frac{99}{35}&\frac{577}{204}&\frac{3363}{1189}&\dots\\ \frac{n_k}{x_k}&\frac11&\frac86&\frac{49}{35}&\frac{288}{204}&\frac{1681}{1189}&\dots \end{array}\tag7 $$ The pair that has $50\le n\le500$, is $(x,n)=(204,288)$.

Checking: $$ \sum_{k=1}^{203}k=20706=\sum_{k=205}^{288}k\tag8 $$

robjohn
  • 326,069
  • 34
  • 421
  • 800
3

See Pi Mu Epsilon Journal Vol. 14 # 6 pp 389-97, 2017.
"House Number Puzzle: Solution Through Bifurcation"

A summary from the above Pi Mu Epsilon publication is given below:

Continued Fraction of √2 is: 1, 3/2, 7/5, 17/12, 41/29, 99/70, 239/169 ... The above (x/y) also form solutions to the Pell's equation: x ² −2 y ² = ±1. The house numbers are products of x and y (the solutions to the above Pell's equation): 1*1; 3*2; 7*5; 17*12; 41*29 ... and the total number of houses are provided by x*x and 2*y*y alternatively. Total number of houses: 1*1; 2*2*2; 7*7; 2*12*12; 41*41 ...

For details see the actual publication.

Alexander Gruber
  • 26,937
  • 30
  • 121
  • 202
0

If you don't know how to solve the problem by continued fraction, you can easily find by try and error (2x² = n² - n) the following solutions: x = 0, n = 0, x = 1, n = 1, x = 6, n = 8, x = 35, n = 49. Having found these solutions, we can see the solutions for n form a row. Each new solution for x is six times the last solution minus the solution before the last solution. 6 is 6 x 1 minus 0 and 35 = 6 x 6 minus 1. The same goes for n, but we have to add 2. 8 = 6 x 1 minus 0 plus 2. 49 = 6 x 8 minus 1 plus 2. So we have the conjecture that the next value for x will be 6 times 35 minus 6 is 204. And that the next n will be 6 x 49 minus 8 plus 2 = 288. Filling these numbers in in the equation 2x² = n² - n proofs the conjecture is right. This way we can find the next solution x = 1.189 an n = 1.681. And so on and on.

  • This is hard to read. Please consider typesetting using [MathJax](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference). – Jacob Manaker Apr 07 '22 at 07:29