# Consecutive averages of sequence (or difference quotients of partial sums) always square

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; the Dropbox comments have more details.)

The official solution can be found on Dropbox (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: 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". But I could easily be wrong about this. Actually, I now think the $r=2$ version at hand closely resembles the Diophantine quintuple conjecture. (As mentioned in the link, A. Dujella has proven that there are no integer Diophantine sextuples.) It also closely resembles the Euler brick and perfect cuboid problems.

By testing small numbers, I've found two non-constant (and "nontrivial-looking") solutions so far:

• $(47^2,23^2,23^2,47^2)$ for $N=K=4$ (with $2,3,4$-averages of $(37^2,23^2,37^2)$; $(33^2,33^2)$; $(37^2)$);
• $(17^2,7^2,23^2)$ for $N=K=3$ (with $2,3$-averages of $(13^2,17^2)$; $(17^2)$).
-
A nice special case is to ask whether a periodic sequence x,y,z,x,y,z,... can have all 1,2,3-averages perfect squares. This is a question about a cover of P^2 obtained by adjoining square roots of 7 linear forms; it would be fun to work out what this surface looks like and whether e.g. one has some rational curves on it. – JSE Jan 8 '14 at 0:35