Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Victor Wang 2013 December TST Problem 2

Find all functions f : N → Z such that (f (m) − f (n))(m − n) is always a square.


Alternative phrasing: Let a1 , a2 , a3 , . . . be a sequence of integers, with the property that every con-
secutive group of ai ’s averages to a perfect square. More precisely, for any positive integers n and k, the
quantity
an + an+1 + · · · + an+k−1
k
is always the square of an integer. Prove that the sequence must be constant (all ai are equal to a fixed
perfect square).
Solution. First, since p(f (n + p) − f (n)) is a square for any prime p and positive integer n, p must divide
f (n + p) − f (n). (Similarly, we may prove pk | f (n + pk ) − f (n) by induction, but we will not need to do so.)
We now investigate the structure of f modulo p. For convenience, let A = A (mod p).

Lemma. If p | f (a) − f (b) but p - a − b for some a, b, then p | f (m) − f (n) for all m, n. (In other words, f
is either injective or constant modulo p.)
We will present three proofs of this lemma.
Proof. For each integer r, define Sr = {x : f (x) ≡ r (mod p)}, which must be a union of residue classes
modulo p (restricted to the positive integers). Then we need to show that either (1) for every r, Sr covers
at most one residue class (and thus exactly one), or (2) for some r, Sr covers all residue classes.
Suppose otherwise; then there exists r such that S = Sr covers between 2 and p − 1 residues (so p ≥ 3).
If n ∈
/ S (i.e. f (n) 6≡ r (mod p)), then for any s ∈ S,

(n − s)(f (n) − f (s)) ≡ (n − s)(f (n) − r) 6≡ 0 (mod p)


f (n)−r
is a nonzero quadratic residue. Hence ( n−s
p )=( p ) 6= 0.
Now let T = {t : ( f (t)−r
p ) = 1} and U = {u : ( f (u)−r
p ) = −1}, so T, U partition N \ S. By the previous
a
paragraph, ( p ) = 1 for any a = t − s in the difference set T − S; similarly, ( pb ) = −1 for any b ∈ U − S.
This immediately upper bounds |T − S| and |U − S| by p−1 2 , the number of (nonzero) quadratic residues
and nonresidues.
But |T | + |U | = p − |S| ≥ 1, so if |T | ≥ |U | (so T is nonempty), then Cauchy-Davenport yields

p−1 p − |S| p + (|S| − 2)


≥ |T − S| ≥ min(p, |T | + | − S| − 1) ≥ min(p, + |S| − 1) = min(p, ),
2 2 2
contradicting |S| ≥ 2. The case |U | ≥ |T | is analogous.

The next proof avoids Cauchy-Davenport by using more of the structure of quadratic residues and
nonresidues.
Proof. Define r and S = Sr as in the previous proof.
Since p ≥ 3, there exists a smallest quadratic nonresidue α ∈ [2, p − 1] modulo p. In particular, α −
1 ∈ [1, p − 2] is a quadratic residue. Now fix two distinct residues x, y (mod p) in S. We claim that for
N = x + α(y − x), we have f (N ) ≡ r (mod p). Suppose otherwise; then f (N ) 6≡ r ≡ f (x) ≡ f (y). But then
[f (N ) − f (x)][N − x] ≡ [f (N ) − r]α(y − x) and [f (N ) − f (y)][N − y] ≡ [f (N ) − r](α − 1)(y − x) must both
be nonzero squares, forcing ( αp ) = ( α−1
p ), which is absurd.
Hence x + α(y − x) = (1 − α)x + αy lies in S (interpret relations modulo p where clearly appropriate)
for any distinct residues x, y ∈ S; of course, it also does when x ≡ y ∈ S. This condition is affine, so for
convenience, fix distinct residues a, b ∈ S and define A = (S − a)(b − a)−1 . Then 0, 1 ∈ A and we still have
(1 − α)x + αy ∈ A whenever x, y ∈ A.
By plugging in x ≡ 0, we get αA ⊆ A, and from y ≡ 0, we get (1 − α)A ⊆ A. Therefore (noting that
p - α, 1 − α)
A + A ≡ (1 − α)(1 − α)p−2 A + ααp−2 A ⊆ (1 − α)A + αA ⊆ A,
so A + 1 ⊆ A =⇒ A = Z/pZ =⇒ S = Z/pZ, as desired.

1
Victor Wang 2013 December TST Problem 2

Our third proof (due to Linus Hamilton), a slight variant of the second, uses an additional observation
to simplify some calculations.
Proof. The previous proof shows that if x, y ∈ S, then x+α(y −x) ∈ S. We claim that N = x+(α+1)(y −x)
lies in S as well. Indeed, the only way [f (N ) − f (y)][N − y] ≡ [f (N ) − r]α(y − x) and [f (N ) − f (x + α(y −
x))][N − (x + α(y − x))] ≡ [f (N ) − r](y − x) can both be quadratic residues is if p | f (N ) − r, so N ∈ S.
But [x + (α + 1)(y − x)] − [x + α(y − x)] = y − x, so we conclude that x + kα(y − x) and x + k(α + 1)(y − x)
lie in S for all k ≥ 0. Since p - α, x + kα(y − x) covers all residues modulo p, so S = Z/pZ, as desired.
Note that f (n + 1) − f (n) is always a square. If f is nonconstant, gcdn≥1 (f (n + 1) − f (n)) 6= 0 must
be a square itself (say g 2 , with g > 0). If g = 1, then f is nonconstant (and thus injective, by the lemma)
modulo every prime p. In particular, p - f (n + 1) − f (n) for all n and p, which forces f (x + 1) − f (x) ≡
1 =⇒ f (x) ≡ x + d for some constant d. Otherwise, if g > 1, f 0 (x) ≡ f (x)−f g2
(1)
has (f 0 (m) − f 0 (n))(m − n)
always a square and gcdn≥1 (f 0 (n + 1) − f 0 (n)) = 1, so f (x) ≡ g 2 (x + d) + c for some constants d, c.
It follows that f (x) ≡ A2 x + B (A, B ∈ Z) are the only possible solutions, which indeed all work (note
that we get f constant when A = 0).

Comment. During the 2010 IMO, Evan O’Dorney proved (for Problem 3) that if (g(m) + n)(g(n) + m)
is always a square, then so is (g(m) − g(n))(m − n). While Alex Zhai and Yi Sun then completed the
solution without too much difficulty, they relied mostly on the fact that for fixed a, (g(a) + n)(g(n) + a) and
(g(a+1)+n)(g(n)+a+1) are always squares, and only used Evan’s deduction to show p | g(a+1)−g(a) =⇒
p2 | g(a + 1) − g(a) for any prime p (which easily leads to g(a + 1) − g(a) = 1). In fact, the key idea here
(finding n such that vp (g(a) + n) and vp (g(a + 1) + n) are simultaneously odd) can be extended to directly
solve the IMO problem; in other words, getting to “(g(m) − g(n))(m − n)” is only a shortcut.
Thus the problem of characterizing f with (f (m) − f (n))(m − n) always a square is of independent
interest.
Comment. The analogous problem for higher powers ( f (a)−f a−b
(b)
always a perfect kth power, for k ≥ 3
fixed) is trivialized by a result of Darmon and Merel: no three distinct kth powers form an arithmetic
progression.

You might also like