Find all positive integers $ n $ such that there exists an integer $ m $ satisfying $$ \frac{1}{n}\sum\limits_{k=m}^{m+n-1}{k^2} $$is a perfect square.
Problem
Source: 2019 Taiwan TST Round 1
Tags: number theory
31.03.2020 18:00
19.08.2020 19:35
hmmmmm as a fellow Aops user , sayd ubermensch wrote: Yay, we're back yet again with another keep-bashing-mindlessly-until-you-get-something problem!
04.08.2023 18:24
The answer is any $n \equiv \pm 1 \pmod{8}$ with $3 \nmid n$. Viewing the summation modulo $n$, we require $n \mid \tfrac{n(n+1)(2n+1)}{6}$ for the expression to be an integer, and if $n$ is even then we get a contradiction by looking at $\nu_2$, hence suppose $n:=2m+1$ is odd. Then rewrite the expression as $$\frac{1}{2m+1}\sum_{i=-m}^m (k+i)^2=\frac{1}{2m+1}\left(k^2+\sum_{i=1}^m ((k+i)^2+(k-i)^2\right)=k^2+\frac{m(m+1)(2m+1)}{3(2m+1)}=k^2+\frac{m(m+1)}{3},$$which we want to equal a square for some choice of $k$, so we want $\tfrac{m(m+1)}{3}$ to be an integer difference of squares. This is equivalent to the condition that the expression is an integer, i.e. $m \not \equiv 1 \pmod{3} \iff 3 \nmid n$, and also that it can be written as the product of two same-parity integers, i.e. $\nu_2(\tfrac{m(m+1)}{3}) \neq 1 \iff m\equiv 0,3 \pmod{4} \iff n \equiv -1,1 \pmod{8}$. $\blacksquare$