Problem : In a street, all the houses are numbered continuously from $1$ to $1000$. Alice lives at number $6$. The sum of the numbers from $1$ to $5$ is equal to that of the numbers from $7$ to $8$, i.e. $15$. Then, Bob lives at number $35$. The sum of the numbers from $1$ to $34$ is equal to that of the numbers from $36$ to $49$, i.e. $595$. Finally, Cedric lives at number $N$, different from Alice’s and Bob’s numbers. The sum of the numbers from $1$ to $(N - 1)$ is equal to that of the numbers from $(N + 1)$ to a certain number strictly greater than $(N + 1)$. What is the value of $N$?
I got to the equation $2N^2=K^2+K$ where K is the number of the higher number house and the official solution consists in listing all the perfect squares from $1$ to $1500$ and their doubles in order to find all possible $N$ and $K$ that satisfy the equation. I'm guessing there's a more efficient way to get to the answer, but I couldn't find it...
Yes, there is a way to solve it using a Pell equation.
We want to find $N$ and $K$ such that $$2N^2 = K^2 + K.$$ Multiply by $4$ on both sides and add one to get $$8N^2 + 1 = 4K^2 + 4K + 1.$$ You can rearrange this as $$(2K + 1)^2 - 2(2N)^2 = 1.$$ Compare this to the Pell equation $$x^2 - 2y^2 = 1.$$ It is well known that the pair $(x, y)$ is a solution to this equation if and only if $$x + y\sqrt{2} = (3 + 2\sqrt{2})^n$$ for some integer $n$. Alice's and Bob's houses correspond to the cases $n = 2$ and $n = 3$. (Check this on your own.) Cedric's house corresponds to $n = 4$. Writing it out, $$(2K + 1) + (2N)\sqrt{2} = (3 + 2\sqrt{2})^4 = 577 + 408\sqrt{2},$$ so that $\boxed{(N, K) = (204, 284)}$.