Artificial intelligent assistant

Continued Fraction Counting Problem The house of my friend is in a long street, numbered on this side one, two, three, and so on. All the numbers on one side of him added up exactly the same as all the numbers on the other side of him. There is more than fifty houses on that side of the street, but not so many as five hundred. If we find the number of the house where my friend lives, the problem had one solution — house no. 204 in a street of 288 houses, i.e. 1+2+ ... 203 = 205 + 206+ . . . 288. But without the 50-to-500 house constraint, there are other solutions. For example, on an eight-house street, no. 6 would be the answer: 1 + 2 + 3 + 4 + 5 = 7 + 8. Ramanujan is reported to have discovered a continued fraction comprising of a single expression with all such correct answers. What is the continued fraction, and how can it be found?

If it is house number $x$ in a street of $y$ houses, we have $$\frac{x(x-1)}{2}+x+\frac{x(x-1)}{2}=\frac{y(y+1)}{2}$$ which simplifes to $$(2y+1)^2-8x^2=1\ .$$ This can be solved by computing the continued fraction $$\sqrt8=2+\frac{1}{1+{}}\frac{1}{4+}\frac{1}{1+{}}\frac{1}{4+\cdots}\ .$$ The table of convergents is $$\matrix{&&2&1&4&1&4&1&4&1&4&\cdots\cr 0&1&2&\color{red}{3}&14&\color{red}{17}&82&\color{red}{99}&478&\color{red}{577}&2786&\cdots\cr 1&0&1&\color{red}{1}&5&\color{red}{6}&29&\color{red}{35}&169&\color{red}{204}&985&\cdots\cr}$$ The pairs beneath the second-last entry in each period (that is, in this case, beneath the $1$s) are marked in red. They give the integer values of $2y+1$ and $x$ satisfying the equation. For example we have firstly $y=1$, $x=1$ (the trivial solution - house numbers on both sides of $1$ add up to $0$). Then $y=8$, $x=6$ as you observed. The fourth solution is Ramanujan's.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 054a0f77e356ba08384a420a0cf52737