How do I solve Problem 1 of the International Olympiad of Metropolis? The question is: Find all $n$ so that there exists $n$ consecutive numbers whose sum is a square!
My method to solve the problem: I would try to look at the values modulo $n$, and there I see there is no possible square for $n=2x>2$, so all even numbers bigger than 2, and that all odd numbers work...
I can also see that the sum of the consecutive numbers is $$\dfrac{((x+1)+(x+n))
\cdot n}{2}$$ So that has to give a square...
But how do I do that? I cannot put my method in application... Am I totally wrong, and I shouldn't do it like that?

As noted in the statement of the question, the sum of $n$ consecutive numbers starting from $x+1$ is given by
$$\sum_{j=x+1}^{x+n}j=\frac{(2x+1+n)n}{2}.$$
If $n=2m+1$ is an odd integer, then we require
$$(x+m+1)(2m+1) = k^2$$
for some integer $k$. Clearly taking $x=m$ will yield a solution (as also noted by Win Vineeth). In fact, there are infinitely many solutions simply by solving for $x$, giving
$$x = \frac{k^2}{n} - (m+1).$$
Then every $k$ such that $n\mid k^2$ will yield a distinct solution $x$, and conversely, these yield all the valid solutions.
On the other hand, if $n=2m$ is an even integer, then we require
$$(2x+2m+1)m=k^2.$$
Let $2^s$ be the largest power of $2$ which divides $m$. Then writing $m=2^sm'$ where $m'$ is odd, we have
$$(2x+2^{s+1}m'+1)2^sm'=k^2.$$
It follows that $s$ must be even, so that if $n$ is even, it must contain an odd number of $2$s in its factorization. Writing $k^2 = 2^sk'^2$ where $k'$ is odd, we then get
$$(2x+2^{s+1}m'+1)m'=k'^2.$$
Then again there are an infinite family of solutions
$$x=\frac{k'^2-m'}{2}-2^{s}m',$$
where every odd $k'$ will yield a distinct solution. Again, these yield all valid solutions.
In summary, there is a solution for $n$ if and only if $n$ is odd or if $n$ is even with an odd number of $2$s in its prime factorization. When there is a solution, there are infinitely many solutions.
