Let be a sequence of integers, with the property that every consecutive group of 's averages to a perfect square. More precisely, for every positive integers and , the quantity
is always the square of an integer. Prove that the sequence must be constant (all are equal to the same perfect square).
Solutions — 3
Solution 1
We prove the following equivalent statement: we show that if is a function such that is always the square of an integer, then must be of the form for integers . First, since is a square for any prime and positive integer , must divide . (Similarly, we may prove by induction, but we will not need to do so.)
Lemma. If but for some , then for all . (In other words, is either injective or constant modulo .)
Proof. For each integer , define , which must be a union of residue classes modulo (restricted to the positive integers). Then we need to show that either (1) for every , covers at most one residue class (and thus exactly one), or (2) for some , covers all residue classes.
Suppose otherwise; then there exists such that covers between 2 and residues (so ). If (i.e. ), then for any ,
is a nonzero quadratic residue. Hence .
Now let and , so partition . By the previous paragraph, for any in the difference set ; similarly, for any . This immediately upper bounds and by , the number of (nonzero) quadratic residues and nonresidues.
But , so if (so is nonempty), then Cauchy-Davenport yields
contradicting . The case is analogous.
Note that is always a square. If is nonconstant, must be a square itself (say , with ). If , then is nonconstant (and thus injective, by the lemma) modulo every prime . In particular, for all and , which forces for some constant . Otherwise, if , has always a square and , so for some constants .
It follows that () are the only possible solutions, which indeed all work (note that we get constant when ).
Solution 2
We give an alternate proof of the lemma. Define and as in the previous proof.
Since , there exists a smallest quadratic nonresidue modulo . In particular, is a quadratic residue. Now fix two distinct residues (mod ) in . We claim that for , we have . Suppose otherwise; then . But then and must both be nonzero squares, forcing , which is absurd.
Hence lies in (interpret relations modulo where clearly appropriate) for any distinct residues ; of course, it also does when . This condition is affine, so for convenience, fix distinct residues and define . Then and we still have whenever .
By plugging in , we get , and from , we get . Therefore (noting that )
so , as desired.
Solution 3
We present yet another proof of the lemma. The previous proof shows that if , then . We claim that lies in as well. Indeed, the only way and can both be quadratic residues is if , so .
But , so we conclude that and lie in for all . Since , covers all residues modulo , so , as desired.