Find all positive integers $n$ such that there exist $n$ consecutive positive integers whose sum is a perfect square.
Problem
Source: International olympiad of metropolises 2016
Tags: number theory, IOM
08.09.2016 10:16
say the starting integer is a, then the sum is $\frac{n(n+2a-1)}{2}$ note that if n is odd and $a=\frac{n+1}{2}$, the sum is then $n^2$, so there are infinitely many n, not sure when n is even, still calculating
08.09.2016 14:59
Write $n$ in the form $n=2^k(2m+1)$ with integers $k,m\ge0$. Answer: such a square exists if and only if (i) $k=0$ or (ii) $k$ is odd. (1) If $k=0$, then pick $a=m+1$. (2) If $k$ is odd, then let $x^2$ be a square that is strictly larger than $2^k$. Pick $a$ so that $2a-1=(2m+1)(y^2-2^k)$. (3) If $k\ge2$ is even, then $\frac12n(n+2a-1)$ is divisible by $2^{k-1}$ but not $2^k$, and cannot be a square.
13.09.2016 22:38
Notice that the sum of all these numbers, say $k+1,\dots, k+n$ equals $S=nk+\frac{n(n+1)}{2}$. Now, if $n$ is odd we set $n=2m-1$. Clearly, setting $k=(2m-1)\cdot s^2-m$ for a sufficiently large $s$ yields that $S=((2m-1)s)^2$ is a perfect square. If $u=v_2(n)>0$ then set $n=2^u\cdot v$ for $v$ odd and see that $S=2^{u-1}\cdot (2k+v\cdot (2^u\cdot v+1))$ and $v_2(S)=u-1$ must be even. Thus $u$ must be odd. Now, take $k=\frac{(2l+1)^2-v\cdot (2^u\cdot v+1)-1}{2}$ for $l$ sufficiently large. Clearly, $k$ is an integer and $S=(2^{\frac{u-1}{2}}\cdot l)^2$ is a perfect square. The discussion concludes and we see that the only such $n$ are those for which $v_2(n)$ is either $0$ or an odd number.
12.07.2024 17:29
The answer is when $\nu_2(n)$ is $0$ or odd. Firstly, if $\nu_2(n) = 0$, then if we let $n = 2k + 1$, we have \[(k + 1) + (k + 2) + \cdots + (3k + 1) = (2k + 1) ^2 \] Now assume $\nu_2(n) > 0$. Let $n = 2k$ for some positive integer $k$. Any $n$ consecutive integers must be of the form $a, a+1, \ldots, a + (2k - 1) $, Now, \[ a + (a + 1) + \cdots + (a + 2k - 1) = (2a + 2k - 1) \cdot k \]Notice that if $\nu_2(n)$ is even, then $\nu_2(k)$ is odd, and $\nu_2(2a + 2k - 1) = 0$, so $\nu_2((2a + 2k - 1) k ) $ is odd, and thus $(2a + 2k - 1) \cdot k$ can't be a perfect square. Thus, $\nu_2(n)$ is odd if $\nu_2(n) > 0$. It suffices to show that all such $n$ work. Let $k = 2^{2c} \cdot r$, where $r$ is odd. Now let $N^2 > 2k - 1$ be a sufficiently large odd perfect square. We may choose $2a + 2k - 1 = N^2 \cdot r$, since $2a + 2k - 1$ can take any odd number greater than $2k - 1$. Now, we have $(2a + 2k - 1) \cdot k = 2^{2c} \cdot N ^2 \cdot r^2$, which is a perfect square, as desired.