How can this problem be solved using continued fractions?

772 Views Asked by At

"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 the 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?"

Ramanujan gave the solution in continued fractions. According to the link below, "The unusual part was that it was the solution to the whole class of problems".

I was trying to solve it and got stuck at finding integral solutions of

            n*(n+1)/2 = x^2

I solved it by trial and error using the fact that n and (n+1) are coprime, making it necessary that whichever be the odd number among n or n+1, it should be a perfect square and the other one should be twice of a perfect square. So, n came out to be 288, for the given range.

But, the problem remains: how can it be solved using continued fraction? https://en.wikipedia.org/wiki/Srinivasa_Ramanujan#Mathematical_achievements

2

There are 2 best solutions below

1
On BEST ANSWER

Other than this answer:


If the house number is $r$, then we have $$ 1+2+\cdots (r-1) = (r+1)+\cdots+ n$$ The LHS is $\frac{r(r-1)}{2}$ and if we add $\frac{r(r+1)}{2}$ to it, we have $$r^2 = \frac{n(n+1)}{2}$$ Multiplying by $8$ and adding $1$, we get, $$8r^2+1 = (2n+1)^2$$


This is the Brahmagupta equation (popularly called Pell’s equation) for which the ancient Indian mathematician Brahmagupta had given a complete solutions! His solution - the ‘CHAKRAVALA’ method - can be expressed using continued fractions as follows.


For a positive integer $N$ which is not a perfect square, the $$\sqrt{N} = [b_0;\overline{b_1,b_2,··· ,b_r,2b_0}]$$ Further, the penultimate convergent $[b_0; b_1, b_2, · · · , b_r]$; in fact, each of the convergents $$ [b_0;b_1,b_2,··· ,b_r,2b_0,b_1,b_2,··· ,b_r]$$ etc. gives a solution of $x^2 −Ny^2 =−1$ or of $x^2 −Ny^2 =1$ according as to whether the period $r + 1$ above is odd or even.


As $$\sqrt{8} = [2;\overline{1,4}]$$, the convergents $\frac{3}{1}, \frac{17}{6}, \frac{99}{35}, \frac{577}{204}, \frac{3363}{1189}$,··· give solutions of $x^2 − 8y^2 = 1$. Hope it helps.

1
On

Divide into the two cases: $n$ odd and $n$ even. Let $n=2y$, then $y(2y+1)=x^2$ if a product of two coprime numbers is a square then both are squares. Let $y=a^2$, $2y+1=b^2$. Then we're trying to find solutions to the Pell equation $$b^2-2a^2=1$$ Applying the same substitutions in the odd case you get $$b^2-2a^2=-1$$ The solutions to both of these equations are given by the convergents of the continued fraction of $\sqrt 2$ of even and odd order, respectively. That is: $$\frac{b}{a}=1+\frac{1}{2+\frac{1}{2+\frac{1}{\ddots 2}}}$$ The first few convergents are $1$,$\frac{3}{2}$,$\frac{7}{5}$,,$\frac{17}{12}$... and you can check $$\begin{align} 1^2-2\times 1^2&=-1\\ 3^2-2\times 2^2&=+1\\ 7^2-2\times 5^2&=-1\\ 17^2-2\times 12^2&=+1 \end{align}$$