I proposed the following problem for the December 2013 USA IMO TST earlier this month: > Let $a_1,a_2,a_3,\ldots$ be a sequence of integers, with the property that every consecutive group of $a_i$'s averages to a perfect square. More precisely, for any positive integers $n$ and $k$, the quantity $$\frac{a_n+a_{n+1}+\cdots+a_{n+k-1}}{k}$$ is always the square of an integer. Prove that the sequence must be constant (all $a_i$ are equal to a fixed perfect square). Note that this can also be rephrased in terms of difference quotients of the partial sums. Actually, the original wording was > Find all functions $f:\mathbb{Z}^+\to\mathbb{Z}$ such that $\frac{f(m)-f(n)}{m-n}$ is always a perfect square. (This version was inspired by Evan O'Dorney's solution to [IMO 2010 Problem 3][1]; the Dropbox comments have more details.) --- The official solution can be found on [Dropbox][2] (none of the test takers found anything substantially different). While I think it's amusing how much structure the local approach (working with quadratic (non)residues modulo primes $p$) gives, I also feel the problem conditions are way stronger than necessary. Does anyone have ideas for the following harder variants? (I'm pretty sure the Dropbox solution fails completely for all of these.) 1. Are there constants $N,K>0$ such that any sequence of integers $a_1,a_2,\ldots,a_N$ with square consecutive averages for $k=1,2,\ldots,K$ must be constant? (Of course, we might as well take $K=N$ here.) 2. ("$N=\infty$" in (1), so strictly easier than (1).) Is there $K>0$ such that any sequence of integers $a_1,a_2,\ldots$ with square consecutive averages for $k=1,2,\ldots,K$ must be constant? (More generally, we can ask for which pairs $(L,K)$ the averages condition for $L\le k\le K$ suffices. But this might not be as interesting, since if the $(1,M)$ version holds, then the $(L,LM)$ version already implies $a_i+\cdots+a_{i+L-1} = a_{i+L}+\cdots+a_{i+2L-1}$ for all $i\ge1$, and if we combine this with $(L+1,(L+1)M)$ and interpret with generating functions or shift operators, we get $a_i$ constant from $\gcd((x^L-1)^2/(x-1),(x^{L+1}-1)^2/(x-1)) = x-1$.) --- Note that for $r\ge3$, (1) and (2) are both "yes" (for just $K=2$) for the corresponding problem on $r$th powers. This follows directly from [a result of Darmon and Merel][3]: no three distinct $r$th powers form an arithmetic progression ("Main Theorem 1" on page 2). For the $r=2$ version at hand, I suspect that $N=3$ or $N=4$ will suffice, since the conditions feel "about as strong" as Fermat's "[no four distinct squares in arithmetic progression][4]". But I could easily be wrong about this. [1]: http://www.artofproblemsolving.com/Forum/viewtopic.php?f=644&t=356076& [2]: https://www.dropbox.com/s/cjv6q29eyw9osjh/2013%20December%20TST%20%232.pdf [3]: http://www.math.jussieu.fr/~merel//winding.pdf [4]: http://math.stackexchange.com/questions/43519/squares-in-arithmetic-progression