Maths Olympiad Prep

Library / IMO Team Selection Test /16 of 20

IMO Team Selection Test

Number theory Difficulty 8.7 Shortlist Prove it United States

Let a1,a2,a3,…a_1, a_2, a_3, \dots be a sequence of integers, with the property that every consecutive group of aia_i's averages to a perfect square. More precisely, for every positive integers nn and kk, the quantity
an+an+1+⋯+an+k−1k \frac{a_n + a_{n+1} + \dots + 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).

Solutions — 3

Solution 1

We prove the following equivalent statement: we show that if f:N→Zf : \mathbb{N} \to \mathbb{Z} is a function such that (f(m)−f(n))(m−n)(f(m) - f(n))(m - n) is always the square of an integer, then ff must be of the form A2x+BA^2x + B for integers A,BA, B. First, since p(f(n+p)−f(n))p(f(n + p) - f(n)) is a square for any prime pp and positive integer nn, pp must divide f(n+p)−f(n)f(n + p) - f(n). (Similarly, we may prove pk∣f(n+pk)−f(n)p^k \mid f(n + p^k) - f(n) by induction, but we will not need to do so.)

Lemma. If p∣f(a)−f(b)p \mid f(a) - f(b) but p∤a−bp \nmid a - b for some a,ba, b, then p∣f(m)−f(n)p \mid f(m) - f(n) for all m,nm, n. (In other words, ff is either injective or constant modulo pp.)
Proof. For each integer rr, define Sr={x:f(x)≡r(modp)}S_r = \{x : f(x) \equiv r \pmod{p}\}, which must be a union of residue classes modulo pp (restricted to the positive integers). Then we need to show that either (1) for every rr, SrS_r covers at most one residue class (and thus exactly one), or (2) for some rr, SrS_r covers all residue classes.

Suppose otherwise; then there exists rr such that S=SrS = S_r covers between 2 and p−1p-1 residues (so p≥3p \ge 3). If n∉Sn \notin S (i.e. f(n)≢r(modp)f(n) \not\equiv r \pmod p), then for any s∈Ss \in S,
(n−s)(f(n)−f(s))≡(n−s)(f(n)−r)≢0(modp) (n-s)(f(n)-f(s)) \equiv (n-s)(f(n)-r) \not\equiv 0 \pmod{p}
is a nonzero quadratic residue. Hence (n−sp)=(f(n)−rp)≠0\left(\frac{n-s}{p}\right) = \left(\frac{f(n)-r}{p}\right) \neq 0.
Now let T={t:(f(t)−rp)=1}T = \{t : \left(\frac{f(t)-r}{p}\right) = 1\} and U={u:(f(u)−rp)=−1}U = \{u : \left(\frac{f(u)-r}{p}\right) = -1\}, so T,UT, U partition N∖S\mathbb{N} \setminus S. By the previous paragraph, (ap)=1\left(\frac{a}{p}\right) = 1 for any a=t−sa = t-s in the difference set T−ST-S; similarly, (bp)=−1\left(\frac{b}{p}\right) = -1 for any b∈U−Sb \in U-S. This immediately upper bounds ∣T−S∣|T-S| and ∣U−S∣|U-S| by p−12\frac{p-1}{2}, the number of (nonzero) quadratic residues and nonresidues.
But ∣T∣+∣U∣=p−∣S∣≥1|T| + |U| = p - |S| \ge 1, so if ∣T∣≥∣U∣|T| \ge |U| (so TT is nonempty), then Cauchy-Davenport yields
p−12≥∣T−S∣≥min⁡(p,∣T∣+∣S∣−1)≥min⁡(p,p−∣S∣2+∣S∣−1)=min⁡(p,p+(∣S∣−2)2), \frac{p-1}{2} \ge |T-S| \ge \min(p, |T| + |S| - 1) \ge \min\left(p, \frac{p-|S|}{2} + |S| - 1\right) = \min\left(p, \frac{p + (|S| - 2)}{2}\right),
contradicting ∣S∣≥2|S| \ge 2. The case ∣U∣≥∣T∣|U| \ge |T| is analogous. □\square

Note that f(n+1)−f(n)f(n+1) - f(n) is always a square. If ff is nonconstant, gcd⁡n≥1(f(n+1)−f(n))≠0\gcd_{n \ge 1}(f(n+1) - f(n)) \ne 0 must be a square itself (say g2g^2, with g>0g > 0). If g=1g=1, then ff is nonconstant (and thus injective, by the lemma) modulo every prime pp. In particular, p∤f(n+1)−f(n)p \nmid f(n+1) - f(n) for all nn and pp, which forces f(x+1)−f(x)≡1  ⟹  f(x)≡x+df(x+1) - f(x) \equiv 1 \implies f(x) \equiv x+d for some constant dd. Otherwise, if g>1g > 1, f′(x)≡f(x)−f(1)g2f'(x) \equiv \frac{f(x)-f(1)}{g^2} has (f′(m)−f′(n))(m−n)(f'(m) - f'(n))(m-n) always a square and gcd⁡n≥1(f′(n+1)−f′(n))=1\gcd_{n \ge 1}(f'(n+1) - f'(n)) = 1, so f(x)≡g2(x+d)+cf(x) \equiv g^2(x+d) + c for some constants d,cd, c.

It follows that f(x)≡A2x+Bf(x) \equiv A^2x + B (A,B∈ZA, B \in \mathbb{Z}) are the only possible solutions, which indeed all work (note that we get ff constant when A=0A=0).

Solution 2

We give an alternate proof of the lemma. Define rr and S=SrS = S_r as in the previous proof.
Since p≥3p \ge 3, there exists a smallest quadratic nonresidue α∈[2,p−1]\alpha \in [2, p-1] modulo pp. In particular, α−1∈[1,p−2]\alpha-1 \in [1, p-2] is a quadratic residue. Now fix two distinct residues x,yx, y (mod pp) in SS. We claim that for N=x+α(y−x)N = x+\alpha(y-x), we have f(N)≡r(modp)f(N) \equiv r \pmod p. Suppose otherwise; then f(N)≢r≡f(x)≡f(y)f(N) \not\equiv r \equiv f(x) \equiv f(y). But then [f(N)−f(x)][N−x]≡[f(N)−r]α(y−x)[f(N)-f(x)][N-x] \equiv [f(N)-r]\alpha(y-x) and [f(N)−f(y)][N−y]≡[f(N)−r](α−1)(y−x)[f(N)-f(y)][N-y] \equiv [f(N)-r](\alpha-1)(y-x) must both be nonzero squares, forcing (αp)=(α−1p)\left(\frac{\alpha}{p}\right) = \left(\frac{\alpha-1}{p}\right), which is absurd.
Hence x+α(y−x)=(1−α)x+αyx+\alpha(y-x) = (1-\alpha)x + \alpha y lies in SS (interpret relations modulo pp where clearly appropriate) for any distinct residues x,y∈Sx, y \in S; of course, it also does when x≡y∈Sx \equiv y \in S. This condition is affine, so for convenience, fix distinct residues a,b∈Sa, b \in S and define A=(S−a)(b−a)−1A = (S-a)(b-a)^{-1}. Then 0,1∈A0, 1 \in A and we still have (1−α)x+αy∈A(1-\alpha)x + \alpha y \in A whenever x,y∈Ax, y \in A.
By plugging in x≡0x \equiv 0, we get αA⊆A\alpha A \subseteq A, and from y≡0y \equiv 0, we get (1−α)A⊆A(1-\alpha)A \subseteq A. Therefore (noting that p∤α,1−αp \nmid \alpha, 1-\alpha)
A+A≡(1−α)(1−α)p−2A+ααp−2A⊆(1−α)A+αA⊆A, A + A \equiv (1-\alpha)(1-\alpha)^{p-2}A + \alpha\alpha^{p-2}A \subseteq (1-\alpha)A + \alpha A \subseteq A,
so A+1⊆A  ⟹  A=Z/pZ  ⟹  S=Z/pZA+1 \subseteq A \implies A = \mathbb{Z}/p\mathbb{Z} \implies S = \mathbb{Z}/p\mathbb{Z}, as desired.

Solution 3

We present yet another proof of the lemma. The previous proof shows that if x,y∈Sx, y \in S, then x+α(y−x)∈Sx + \alpha(y-x) \in S. We claim that N=x+(α+1)(y−x)N = x + (\alpha+1)(y-x) lies in SS as well. Indeed, the only way [f(N)−f(y)][N−y]≡[f(N)−r]α(y−x)[f(N)-f(y)][N-y] \equiv [f(N)-r]\alpha(y-x) and [f(N)−f(x+α(y−x))][N−(x+α(y−x))]≡[f(N)−r](y−x)[f(N)-f(x+\alpha(y-x))][N-(x+\alpha(y-x))] \equiv [f(N)-r](y-x) can both be quadratic residues is if p∣f(N)−rp \mid f(N)-r, so N∈SN \in S.
But [x+(α+1)(y−x)]−[x+α(y−x)]=y−x[x+(\alpha+1)(y-x)] - [x+\alpha(y-x)] = y-x, so we conclude that x+kα(y−x)x+k\alpha(y-x) and x+k(α+1)(y−x)x+k(\alpha+1)(y-x) lie in SS for all k≥0k \ge 0. Since p∤αp \nmid \alpha, x+kα(y−x)x+k\alpha(y-x) covers all residues modulo pp, so S=Z/pZS = \mathbb{Z}/p\mathbb{Z}, as desired.

Want a route through all this instead of an archive? The track puts 2,604 problems in a working order, from Junior Challenge level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.