Maths Olympiad Prep

Track / Stage 6 / 75 of 400 #1075 of 1964

Problem 1075

National olympiad, first round
Number theory Difficulty 6.1 Prove it

Let a1,a2,a3,a_{1}, a_{2}, a_{3}, \ldots be a sequence of integers, with the property that every consecutive group of aia_{i} 's averages to a perfect square. More precisely, for all positive integers nn and kk, the quantity
an+an+1++an+k1k \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 aia_{i} are equal to the same perfect square).

This one wants a proof. Work it on paper, then read the official solution and mark yourself. Be honest about it: the record is only any use to you if it is.

Official solution

Let νp(n)\nu_{p}(n) denote the largest exponent of pp dividing nn. The problem follows from the following proposition.
Proposition
Let (an)\left(a_{n}\right) be a sequence of integers and let pp be a prime. Suppose that every consecutive group of aia_{i} 's with length at most pp averages to a perfect square. Then νp(ai)\nu_{p}\left(a_{i}\right) is independent of ii.
We proceed by induction on the smallest value of νp(ai)\nu_{p}\left(a_{i}\right) as ii ranges (which must be even, as each of the aia_{i} are themselves a square). First we prove two claims.
Claim - If jk(modp)j \equiv k(\bmod p) then ajak(modp)a_{j} \equiv a_{k}(\bmod p).

Proof. Taking groups of length pp in our given, we find that paj++aj+p1p \mid a_{j}+\cdots+a_{j+p-1} and paj+1++aj+pp \mid a_{j+1}+\cdots+a_{j+p} for any jj. So ajaj+p(modp)a_{j} \equiv a_{j+p}(\bmod p) and the conclusion follows.
Claim - If some aia_{i} is divisible by pp then all of them are.

Proof. The case p=2p=2 is trivial so assume p3p \geq 3. Without loss of generality (via shifting indices) assume that a10(modp)a_{1} \equiv 0(\bmod p), and define
Sn=a1+a2++ana2++an(modp). S_{n}=a_{1}+a_{2}+\cdots+a_{n} \equiv a_{2}+\cdots+a_{n} \quad(\bmod p) .

Call an integer kk with 2k<p2 \leq k<p a pivot if 1k11-k^{-1} is a quadratic nonresidue modulo pp.
We claim that for any pivot k,Sk0(modp)k, S_{k} \equiv 0(\bmod p). If not, then
a1+a2++akk and a2++akk1 \frac{a_{1}+a_{2}+\cdots+a_{k}}{k} \text { and } \frac{a_{2}+\cdots+a_{k}}{k-1}
are both qudaratic residues. Division implies that k1k=1k1\frac{k-1}{k}=1-k^{-1} is a quadratic residue, contradiction.

Next we claim that there is an integer mm with SmSm+10(modp)S_{m} \equiv S_{m+1} \equiv 0(\bmod p), which implies pam+1p \mid a_{m+1}. If 2 is a pivot, then we simply take m=1m=1. Otherwise, there are 12(p1)\frac{1}{2}(p-1) pivots, one for each nonresidue (which includes neither 0 nor 1 ), and all pivots lie in [3,p1][3, p-1], so we can find an mm such that mm and m+1m+1 are both pivots.

Repeating this procedure starting with am+1a_{m+1} shows that a2m+1,a3m+1,a_{2 m+1}, a_{3 m+1}, \ldots must all be divisible by pp. Combined with the first claim and the fact that m<pm<p, we find that all the aia_{i} are divisible by pp.

The second claim establishes the base case of our induction. Now assume all aia_{i} are divisible by pp and hence p2p^{2}. Then all the averages in our proposition (with length at most pp ) are divisible by pp and hence p2p^{2}. Thus the map ai1p2aia_{i} \mapsto \frac{1}{p^{2}} a_{i} gives a new sequence satisfying the proposition, and our inductive hypothesis completes the proof.
Remark. There is a subtle bug that arises if one omits the condition that kpk \leq p in the proposition. When k=p2k=p^{2} the average a1++ap2p2\frac{a_{1}+\cdots+a_{p^{2}}}{p^{2}} is not necessarily divisible by pp even if all the aia_{i} are. Hence it is not valid to divide through by pp. This is why the condition kpk \leq p was added.

Source: NuminaMath-1.5, licensed Apache-2.0. Statement and solution reproduced as published; topic, difficulty and ordering added by this site.