22
Mathematics Olympiad Coachs Seminar, Zhuhai, China 1 03/23/2004 Number Theory 1. Prove that for every positive integer n there exists an n-digit number divisible by 5 n all of whose digits are odd. 2. Determine all finite nonempty sets S of positive integers satisfying i + j gcd(i, j ) is an element of S for all i, j in S , where gcd(i, j ) is the greatest common divisor of i and j . 3. Suppose that the set {1, 2, ··· , 1998} has been partitioned into disjoint pairs {a i ,b i } (1 i 999) so that for all i, |a i - b i | equals 1 or 6. Prove that the sum |a 1 - b 1 | + |a 2 - b 2 | + ··· + |a 999 - b 999 | ends in the digit 9. Solution: Let k denote the number of pairs {a i ,b i } with |a i - b i | = 6. Then the sum in question is k · 6 + (999 - k) · 1 = 999 + 5k, which ends in 9 provided k is even. Hence it suffices to show that k is even. Write k = k odd + k even , where k odd (resp. k even ) is equal to the number of pairs {a i ,b i } with a i ,b i both odd (resp. even). Since there are as many even numbers as odd numbers between 1 and 1998, and since each pair {a i ,b i } with |a i - b i | = 1 contains one number of each type, we must have k odd = k even . Hence k = k odd + k even is even as claimed. 4. For a real number x, let bxc denote the largest integer that is less than or equal to x. Prove that (n - 1)! n(n + 1) is even for every positive integer n. 5. Let p 1 ,p 2 ,p 3 ,... be the prime numbers listed in increasing order, and let x 0 be a real number between 0 and 1. For positive integer k, define x k =0 if x k-1 =0, p k x k-1 if x k-1 6=0, where {x} = x -bxc denotes the fractional part of x. Find, with proof, all x 0 satisfying 0 <x 0 < 1 for which the sequence x 0 , x 1 , x 2 ,... eventually becomes 0. Solution: The sequence eventually becomes 0 if and only if x 0 is a rational number. First we prove that, for k 1, every rational term x k has a rational predecessor x k-1 . Suppose x k is rational. If x k = 0 then either x k-1 = 0 or p k /x k-1 is a positive integer; either way, x k-1 is rational. If x k is rational and nonzero, then the relation x k = p k x k-1 = p k x k-1 - p k x k-1

118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

Embed Size (px)

DESCRIPTION

Buen folleto

Citation preview

Page 1: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

Mathematics Olympiad Coachs Seminar, Zhuhai, China 1

03/23/2004

Number Theory

1. Prove that for every positive integer n there exists an n-digit number divisible by 5n all of whosedigits are odd.

2. Determine all finite nonempty sets S of positive integers satisfying

i + j

gcd(i, j)is an element of S for all i, j in S,

where gcd(i, j) is the greatest common divisor of i and j.

3. Suppose that the set {1, 2, · · · , 1998} has been partitioned into disjoint pairs {ai, bi} (1 ≤ i ≤ 999)so that for all i, |ai − bi| equals 1 or 6. Prove that the sum

|a1 − b1|+ |a2 − b2|+ · · ·+ |a999 − b999|

ends in the digit 9.

Solution: Let k denote the number of pairs {ai, bi} with |ai − bi| = 6. Then the sum in questionis k · 6 + (999− k) · 1 = 999 + 5k, which ends in 9 provided k is even. Hence it suffices to show thatk is even.

Write k = kodd+keven, where kodd (resp. keven) is equal to the number of pairs {ai, bi} with ai, bi bothodd (resp. even). Since there are as many even numbers as odd numbers between 1 and 1998, andsince each pair {ai, bi} with |ai−bi| = 1 contains one number of each type, we must have kodd = keven.Hence k = kodd + keven is even as claimed.

4. For a real number x, let bxc denote the largest integer that is less than or equal to x. Prove that⌊

(n− 1)!n(n + 1)

is even for every positive integer n.

5. Let p1, p2, p3, . . . be the prime numbers listed in increasing order, and let x0 be a real number between0 and 1. For positive integer k, define

xk = 0 if xk−1 = 0,

{pk

xk−1

}if xk−1 6= 0,

where {x} = x− bxc denotes the fractional part of x. Find, with proof, all x0 satisfying 0 < x0 < 1for which the sequence x0, x1, x2, . . . eventually becomes 0.

Solution: The sequence eventually becomes 0 if and only if x0 is a rational number.

First we prove that, for k ≥ 1, every rational term xk has a rational predecessor xk−1. Suppose xk isrational. If xk = 0 then either xk−1 = 0 or pk/xk−1 is a positive integer; either way, xk−1 is rational.If xk is rational and nonzero, then the relation

xk ={

pk

xk−1

}=

pk

xk−1−

⌊pk

xk−1

Page 2: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

2 Zuming Feng ([email protected]), Phillips Exeter Academy, Exeter 03833, USA

yieldsxk−1 =

pk

xk +⌊

pk

xk−1

⌋ ,

which shows that xk−1 is rational. Since every rational term xk with k ≥ 1 has a rational predecessor,it follows by induction that, if xk is rational for some k, then x0 is rational. In particular, if thesequence eventually becomes 0, then x0 is rational.

To prove the converse, observe that if xk−1 = m/n with 0 < m < n, then xk = r/m, where r isthe remainder that results from dividing npk by m. Hence the denominator of each nonzero term isstrictly less than the denominator of the term before. In particular, the number of nonzero terms inthe sequence cannot exceed the denominator of x0.

Note that the above argument applies to any sequence {pk} of positive integers, not just the sequenceof primes.

6. A square can be cut into n congruent squares, and a square can be cut into n+m congruent squares.Determine all m such that the values of n is unique.

7. Prove that for each n ≥ 2, there is a set S of n integers such that (a−b)2 divides ab for every distincta, b ∈ S.

Solution: We will prove by induction on n, that we can find such a set Sn, all of whose ele-ments are nonnegative. For n = 2, we may take S2 = {0, 1}.Now suppose that for some n ≥ 2, the desired set Sn of n nonnegative integers exists. Let L be theleast common multiple of those numbers (a − b)2 and ab that are nonzero, with (a, b) ranging overpairs of distinct elements from Sn. Define

Sn+1 = {L + a : a ∈ Sn} ∪ {0}.

Then Sn+1 consists of n + 1 nonnegative integers, since L > 0. If α, β ∈ Sn+1 and either α of β iszero, then (α− β)2 divides αβ. If L + a, L + b ∈ Sn+1, with a, b distinct elements of Sn, then

(L + a)(L + b) ≡ ab ≡ 0 (mod(a− b)2),

so [(L + a)− (L + b)]2 divides (L + a)(L + b), completing the inductive step.

8. Let M be the number of integer solutions of the equations

x2 − y2 = z3 − t3

with the property 0 ≤ x, y, z, t ≤ 106, and let N be the number of integer solutions of the equation

x2 − y2 = z3 − t3 + 1

that have the same property. Prove that M > N .

Solution: Write down two equations in the form

x2 + t3 = y2 + z3 and x2 + t3 = y2 + z3 + 1

Page 3: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

Mathematics Olympiad Coachs Seminar, Zhuhai, China 3

and, for each k = 0, 1, 2, . . . , denote y nk the number of integer solutions of the equations u2 +v3 = kwith the property 0 ≤ u, v ≤ 106. Clearly nk = 0 for all k greater than ` = (106)2 + (106)3. Notethat

M = n20 + n2

1 + · · ·+ n2` and N = n0n1 + n1n2 + · · ·+ n`−1n`. (1)

To prove, for example, the second of these equalities, note that to any integer solution of x2 + y3 =y2 + z3 + 1 with ) ≤ x, y, z, t ≤ 106 there corresponds a k (1 ≤ k ≤ `) such that

x2 + t3 = k and y2 + z3 = k − 1. (2)

And for any such k, the pairs (x, t) and (y, z) satisfying (2) can be chosen independently of oneanother in nk and nk−1 ways, respectively. Hence for each k = 1, 2, . . . , ` there are nk−1nk solutionsof x2 + t3 = y2 + z3 + 1 with x2 + y3 = y2 + z3 + 1 = k, which implies the second equality in (1).The proof of the first is essentially the same.

It is not hard to deduce from (1) that M > N. Indeed, a little algebra work shows that

M −N =n2

0 + (n0 − n1)2 + (n1 − n2)2 + · · ·+ (n`−1 − n`)2 + n2`

2> 0,

since n0 = 1 > 0.

9. Let p be a prime number greater than 5. For any integer x, define

fp(x) =p−1∑

k=1

1(px + k)2

.

Prove that for all positive integers x and y, the numerator of fp(x) − fp(y), when written in lowestterms, is divisible by p3.

Solution: We use the notation r ≡ s (mod n), for r and s rational numbers, to mean thatthe numerator of r − s, when written in lowest terms, is divisible by n. This relation is symmetricand transitive, just like congruence for integers.

It suffices to check that fp(x) ≡ fp(x + 1) (mod p3), or in other words,

0 ≡p−1∑

i=1

(1

(xp + i)2− 1

(xp + p + i)2

)=

p−1∑

i=1

(xp + i + p)2 − (xp + i)2

(xp + i)2(xp + p + i)2

=p−1∑

i=1

p(2xp + 2i + p)(xp + i)2(xp + p + i)2

(mod p3).

Of course, it suffices to show that after dividing both sides by p, the results are congruent modulo p2.For integer y and z, (y+zp)2 ≡ y(y+2zp) (mod p2), so (y+zp)2(y−2zp) ≡ y(y+2zp)(y−2zp) ≡ y3

(mod p2). Further suppose that y is not divisible by p. It follows that

1(y + zp)2

≡ y − 2zp

y3(mod p2). (∗)

Page 4: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

4 Zuming Feng ([email protected]), Phillips Exeter Academy, Exeter 03833, USA

(For a motivation of congruence (∗) please read the note at the end of the proof.) Thus

p−1∑

i=1

2i + p(2x + 1)(xp + i)2(xp + p + i)2

≡p−1∑

i=1

2i + p(2x + 1)i6

(i− 2xp)[i− 2p(x + 1)]

=p−1∑

i=1

2i + p(2x + 1)i6

[i2 − 2p(2x + 1)i + 4p2x(x + 1)]

≡p−1∑

i=1

2i + p(2x + 1)i5

[i− 2p(2x + 1)]

=p−1∑

i=1

2i2 + pi(2x + 1)− 4pi(2x + 1)− 2p2(2x + 1)2

i5

≡p−1∑

i=1

2i3

+ 3p(2x + 1)p−1∑

i=1

1i4

(mod p2).

The rest of our proof is based on the following lemma.

Lemma. If n is an integer not divisible by p− 1, then∑p−1

i=1 in ≡ 0 (mod p).

Proof: Let g be a primitive root of p, that is, g is an integer relatively prime to p such that

{g, g2, . . . , gp−1} ≡ {1, 2, . . . , p− 1} (mod p).

Because g is relatively prime to p,

{g · 1, g · 2, . . . , g · (p− 1)} ≡ {1, 2, 3, . . . , p− 1} (mod p).

Consequently,p−1∑

i=1

in ≡p−1∑

i=1

(ig)n = gnp−1∑

i=1

in

Because gn 6≡ 1 (mod p), we must have∑p−1

i=1 in ≡ 0 (mod p), as desired.

For p ≥ 7, we may apply this with n = −4. Combining this with the previous congruence, we get

p−1∑

i=1

2i + p(2x + 1)(xp + i)2(xp + p + i)2

≡p−1∑

i=1

2i3

(mod p2).

Now note that

p−1∑

i=1

2i3

≡p−1∑

i=1

(1i3

+1

(p− i)3

)≡

p−1∑

i=1

p(p2 − 3pi + 3i2)i3(p− i)3

≡p−1∑

i=1

3i2p

i3(p− i)3≡

p−1∑

i=1

−3p

i4≡ 0 (mod p2),

by the lemma. This proves the desired result.

Page 5: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

Mathematics Olympiad Coachs Seminar, Zhuhai, China 5

Note: The congruence (∗) is suggested by formally expanding 1( y + zp)2 as an infinite series:

1(y + zp)2

= y2(1 + p(z/y))−2 = y2(1− 2p(z/y) + 3p2(z/y)2 + · · · ).

This expansion of course does not converge in the real numbers; however, it does converge in adifferent number system known as the p-adic numbers.

10. Let n be a positive integer, and let σ(n) denote the sum of the positive divisors of n, including 1 andn itself. Prove that

σ(1)1

+σ(2)

2+ · · ·+ σ(n)

n≤ 2n.

11. Let a, b be integers greater than 2. Prove that there exists a positive integer k and a finite sequencen1, n2, . . . , nk of positive integers such that n1 = a, nk = b, and nini+1 is divisible by ni + ni+1 foreach i (1 ≤ i < k).

Comment: We may say two positive integers a and b are connected, denoted by a ↔ b, if thereexists a positive integer k and a finite sequence n1, n2, . . . , nk of positive integers such that n1 = a,nk = b, and nini+1 is divisible by ni + ni+1 for each i (1 ≤ i < k). The problem asks to prove thata ↔ b for all a, b > 2.

It is not difficult to check that ↔ is an equivalence relation: it is reflexive (a ↔ a), symmetric (a ↔ bimplies b ↔ a). and transitive (a ↔ b, b ↔ c imply a ↔ c). We state this here so that it may beused without further comment in all solutions.

First Solution: (by William Deringer) The condition (ni + ni+1)‖nini+1 holds whenever ni+1 =ni(d− 1), where d is any divisor of ni greater than 1. Indeed,

ni + ni+1 = nid‖n2i ‖n2

i (d− 1) = nini+1.

Therefore, if d is any divisor of n, then n ↔ n(d − 1)k for any nonnegative integer k, and n ↔n(d− 1) ↔ n(d− 1)(d− 2) ↔ · · · ↔ n

∏d−1i=c i for any natural number c < d.

Whenever a > b > 2, there exists a natural number ` such that (b− 1)` > a. Let

X =(b−1)`∏

i=b

i.

Then

a ↔ aa−1∏

i=b

i =a∏

i=b

i ↔ (b− 1)`a∏

i=b

i ↔ (b− 1)`a∏

i=b

i

(b−1)`−1∏

i=a+1

i = X,

and

b ↔ b(b− 1)` ↔ b(b− 1)`

(b−1)`−1∏

i=b+1

i = X.

Therefore, a ↔ X and b ↔ X, so a ↔ b, as desired.

Page 6: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

6 Zuming Feng ([email protected]), Phillips Exeter Academy, Exeter 03833, USA

Second Solution: Note that for any positive integer n with n ≥ 3, n ↔ 2n, as the sequence

n ↔ n(n− 1) ↔ n(n− 1)(n− 2) ↔ n(n− 2) ↔ 2n

satisfies the conditions of the problem. For any positive integer n ≥ 4, n′ = (n − 1)(n − 2) ≥ 3,hence n′ ↔ 2n′ by the above argument. It follows that n ↔ n− 1 for n ≥ 4 by n′ ↔ 2n′ and by thesequences

n ↔ n(n− 1) ↔ n(n− 1)(n− 2)↔ n(n− 1)(n− 2)(n− 3) ↔ 2(n− 1)(n− 2)↔ (n− 1)(n− 2) ↔ n− 1.

Iterating this, we connect all integers larger than 2.

Third Solution: Note that ni + ni+1‖nini+1 if and only if

(ni + ni+1)‖[(ni + ni+1)ni − nini+1] = n2i .

This means that ni+1 can be d − ni where d is any divisor of n2i , as long as that is positive. We

repeatedly use this to obtain the following facts.

• Fact 1 By successively taking ni = 4a, 4a(a− 1), 4a(a + 1), we have

4a ↔ 4a2 − 4a = 4a(a− 1) ↔ 8a2 − 4a(a− 1) = 4a(a + 1) ↔ 4(a + 1)2 − 4a(a + 1) = 4(a + 1)

for integers a ≥ 2.

• Fact 2 4 ↔ 42 − 4 = 12.

• Fact 3 2a ↔ 2a2 − 2a = 2a(a− 1) for all a ≥ 2.

• Fact 4 a ↔ a2 − a = a(a− 1) for all a ≥ 2.

We also note that a(a− 1) is even for all integers a.

The first two facts together prove that all positive multiples of 4 are connected. The third fact provesthat each even number ≥ 4 is connected to some multiple of 4, so by the first two results, all evennumbers ≥ 4 are connected. The fourth fact proves that all numbers ≥ 3 are connected to some evennumber at least 4, so all numbers at least 3 are connected.

Fourth Solution: As in the first solution, observe that if d > 2 and n is a multiple of d, thenn ↔ (d− 1)n.

Let us call a positive integer k safe if n ↔ kn for all n > 2. Notice that any product of safe numbersis safe. Now, we claim that 2 is safe. To prove this, define f(n), for n > 2, to be the smallest divisorof n that is greater than 2. We show that n ↔ 2n by strong induction on f(n). In case f(n) = 3, weimmediately have n ↔ 2n by our initial observation. Otherwise, notice that f(n)− 1 is a divisor of(f(n)−1)n that is greater than 2 and less than f(n). By the minimality of f , f((f(n)−1)n) < f(n),and so the induction hypothesis gives (f(n) − 1)n ↔ 2(f(n) − 1)n. We also have n ↔ (f(n) − 1)n(by our earlier observation) and 2(f(n)− 1)n ↔ 2n (by the same observation, because f(n) dividesn, and so f(n) divides 2n). Thus, n ↔ 2n. This completes the induction step and proves the claim.

Page 7: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

Mathematics Olympiad Coachs Seminar, Zhuhai, China 7

Next, we show that any prime p is safe, again by strong induction. The base case p = 2 has alreadybeen done. If p is an odd prime, then p + 1 is a product of primes strictly less than p, which are safeby the induction hypothesis; hence, p + 1 is safe. Thus, for any n > 2,

n ↔ (p + 1)n ↔ p(p + 1)n ↔ pn.

This completes the induction step. Thus, all primes are safe, and hence every integer ≥ 2 is safe. Inparticular, our given numbers a, b are safe, so we have a ↔ ab ↔ b, as needed.

12. Find all ordered triples of primes (p, q, r) such that

p | qr + 1, q | rp + 1, r | pq + 1.

Solution: Answer: (2, 5, 3) and cyclic permutations.

We check that this is a solution:

2 | 126 = 53 + 1, 5 | 10 = 32 + 1, 3 | 33 = 25 + 1.

Now let p, q, r be three primes satisfying the given divisibility relations. Since q does not divideqr + 1, p 6= q, and similarly q 6= r, r 6= p, so p, q and r are all distinct. We now prove a lemma.

Lemma. Let p, q, r be distinct primes with p | qr + 1, and p > 2. Then either 2r | p − 1 orp | q2 − 1.

Proof: Since p | qr + 1, we have

qr ≡ −1 6≡ 1 (mod p), because p > 2,

butq2r ≡ (−1)2 ≡ 1 (mod p).

Let d be the order of q mod p; then from the above congruences, d divides 2r but not r. Since r isprime, the only possibilities are d = 2 or d = 2r. If d = 2r, then 2r | p− 1 because d | p− 1. If d = 2,then q2 ≡ 1 (mod p) so p | q2 − 1. This proves the lemma.

Now let’s first consider the case where p, q and r are all odd. Since p | qr + 1, by the lemma either2r | p− 1 or p | q2 − 1. But 2r | p− 1 is impossible because

2r | p− 1 =⇒ p ≡ 1 (mod r) =⇒ 0 ≡ pq + 1 ≡ 2 (mod r)

and r > 2. So we must have p | q2 − 1 = (q − 1)(q + 1). Since p is an odd prime and q − 1, q + 1 areboth even, we must have p | q−1

2 or p | q+12 ; either way, p ≤ q+1

2 < q. But then by a similar argumentwe may conclude q < r, r < p, a contradiction.

Thus, at least one of p, q, r must equal 2. By a cyclic permutation we may assume that p = 2. Nowr | 2q + 1, so by the lemma, either 2q | r − 1 or r | 22 − 1. But 2q | r − 1 is impossible as before,because q divides r2 + 1 = (r2 − 1) + 2 and q > 2. Hence, we must have r | 22 − 1. We concludethat r = 3, and q | r2 + 1 = 10. Because q 6= p, we must have q = 5. Hence (2, 5, 3) and its cyclicpermutations are the only solutions.

Page 8: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

8 Zuming Feng ([email protected]), Phillips Exeter Academy, Exeter 03833, USA

13. Find all pairs of nonnegative integers (m,n) such that

(m + n− 5)2 = 9mn.

Solution: The equation is symmetric in m and n. The solutions are the unordered pairs

(5F 22k, 5F 2

2k+2), (L22k−1, L

22k+1),

where k is a nonnegative integer and {Fj}, {Lj} are the Fibonacci and Lucas sequences, respec-tively — that is, the sequences defined by F1 = F2 = 1, L1 = 1, L2 = 3, and the recursive relationsFj+2 = Fj+1 + Fj and Lj+2 = Lj+1 + Lj for j ≥ 1. Note that we amended the Lucas sequence byconsidering L1 = −1 and L0 = 2.

Let g = gcd(m,n) and write m = gm1 and n = gn1. Because 9mn is a perfect square, m1 and n1

are perfect squares. Let m1 = x2 and n1 = y2. The given condition becomes

(gx2 + gy2 − 5)2 = 9g2x2y2.

Taking the square root on both sides yields

g(x2 + y2)− 5 = ±3gxy,

org(x2 + y2 ± 3xy) = 5.

If g(x2 + y2 + 3xy) = 5, then x2 + y2 + 3xy ≤ 5, implying that x = y = g = 1 and (m,n) = (1, 1).

Otherwise, g(x2 + y2 − 3xy) = 5 and g = 1 or 5. Fix g equal to one of these values, so that

x2 − 3xy + y2 =5g. (1)

We call an unordered pair (a, b) a g-pair if (x, y) = (a, b) (or equivalently, (x, y) = (b, a)) satisfies (1)and a and b are positive integers. Also, we call an unordered pair (p, q) smaller (respectively, larger)than another unordered pair (r, s) if p + q is smaller (respectively, larger) than r + s.

Suppose that (a, b) is a g-pair. View (1) as a monic quadratic in x with y = b constant. The coefficientof x in a monic quadratic function (x− r1)(x− r2) equals −(r1 + r2), implying that (3b−a, b) shouldalso satisfy (1). Indeed,

b2 − 3b(3b− a) + (3b− a)2 = a2 − 3ab + b2 =5g.

Also, if b > 2, note that

a2 − 3ab + b2 =5g

< b2.

It follows that a2 − 3ab < 0 and so 3b− a > 0. Thus, if (a, b) is a g-pair with b > 2, then (b, 3b− a)is a g-pair as well. Also note that for a′ = b and b′ = 3b− a, (b′, 3b′ − a′) = (a, b).

Furthermore, if a ≥ b, note that a 6= b because otherwise −a2 = g > 0, which is impossible. Thus,a > b and

a2 − 3ab + b2 =5g

> b2 − a2,

Page 9: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

Mathematics Olympiad Coachs Seminar, Zhuhai, China 9

which implies that a(2a− 3b) > 0 and hence a+ b > b+(3b−a) and also 3b−a > b. Thus, (b, 3b−a)is a smaller g-pair than (a, b) with b ≥ 3b− a.

Given any g-pair (a, b) with b ≤ a, if b ≤ 2 then a must equal r(g), where r(5) = 3 if r(1) = 4.Otherwise, according to the above observation we can repeatedly reduce it to a smaller g-pair untilmin(a, b) ≤ 2 — that is, to the g-pair (r(g), 1).

Beginning with (r(g), 1), we reverse the reducing process so that (x, y) is replaced by the larger g-pair(3x− y, x). Moreover, this must generate all g-pairs since all g-pairs can be reduced to (r(g), 1). Wemay express these possible pairs in terms of the Fibonacci and Lucas numbers; for g = 1, observethat L2 = 1, L3 = 4 = r(1), and that

L2k+3 = L2k+2 + L2k+1 = (L2k+1 + L2k) + L2k+1

= (L2k+1 + (L2k+1 − L2k−1)) + L2k+1

= 3L2k+1 − L2k−1

for k ≥ 0. For g = 5, the Fibonacci numbers satisfy an analogous recursive relation, and F2 = 1,F4 = 3 = r(5). Therefore, (m,n) = (L2

2k−1, L22k+1) and (m, n) = (5F 2

2k, 5F 22k+2) for k ≥ 0.

14. Find in explicit form all ordered pairs of positive integers (m,n) such that mn− 1 divides m2 + n2.

Solution: Half of the answers are

(m`, n`) = (a1r`+11 + a2r

`+12 , a1r

`1 + a2r

`2) for ` = 0, 1, 2, . . . ,

and(m`, n`) = (a2r

`+11 + a1r

`+12 , a2r

`1 + a1r

`2) for ` = 0, 1, 2, . . . ,

where

r1 =5 +

√21

2, r2 =

5−√212

;

a1 =21−√21

42, a2 =

21 +√

2142

.

The other half of the solutions are obtained by reversing the above solutions.

Assume that (m,n) satisfies the conditions of the problem. Then there is a positive integer k suchthat

k(mn− 1) = m2 + n2. (1)

It is clear that (m, n) 6= (1, 1). Without loss of generality we may assume that m ≥ n. Then m ≥ 2.Note that m 6= n: otherwise we would have k(m2 − 1) = 2m2, but 2 < 2m2/(m2 − 1) < 3 for m ≥ 2.Hence we may assume that m ≥ n + 1. We consider the quadratic equation

x2 − knx + n2 + k = 0. (2)

Let x1 and x2 be the two solutions of (2). Then x1x2 = n2 + k and x1 + x2 = kn. By equation (1),equation (2) has an integer root x1 = m. Hence equation (2) has another integer root x2 = kn−m =(n2+k)/m. Because m,n, k > 0, x2 > 0. We claim that x2 < n if n ≥ 2. Indeed, n−x2 = n+m−kn,so

(mn− 1)(n− x2) = (mn− 1)(m + n)− n(m2 + n2)= mn2 −m− n− n3.

Page 10: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

10 Zuming Feng ([email protected]), Phillips Exeter Academy, Exeter 03833, USA

Therefore, x2 < n if and only if m(n2 − 1)− n3 − n > 0.

If m ≥ n + 2, then

m(n2 − 1)− n3 − n ≥ (n + 2)(n2 − 1)− n3 − n = 2(n2 − n− 1) > 0,

implying that x2 < n.

If n ≥ 3 and m = n + 1, then

m(n2 − 1)− n3 − n = n2 − 2n− 1 > 0,

implying that x2 < n.

If n = 2 and m = 3, then k = 135 is not an integer, a contradiction.

From the above argument, we conclude that if (m,n), m > n ≥ 2, is pair of integers satisfying theconditions of the problem, then there is another pair of positive integers (m′, n′) = (n, kn − m),m > n = m′ > n′, also satisfying the conditions of the problem, where

k =m2 + n2

mn− 1=

(m′)2 + (n′)2

m′n′ − 1.

We can repeat this process if n′ ≥ 2. Hence to find all pairs of positive integers (m,n) satisfying theconditions of the problem, we may start by assuming n = 1. Then

k =m2 + 1m− 1

= m + 1 +2

m− 1,

implying that (m− 1) divides 2, that is, m = 2 or m = 3. In either case, we obtain k = 5. Thereforeall solutions can be reduced to either (1, 2) or (1, 3) via the transformation (m, n) → (n, 5n−m). Nowwe can reverse this process by applying the inverse transformation (x, y) → (5x − y, x) repeatedly,starting with either (2, 1) or (3, 1), to generate all solutions. Furthermore, all solutions can beexpressed as consecutive terms (xk+1, xk) or (yk+1, yk) of the sequences {xk}∞k=0 and {yk}∞k=0, givenby

xk+2 = 5xk+1 − xk and yk+2 = 5yk+1 − yk,

where x0 = 1, x1 = 2 and y0 = 1, y1 = 3. In either case, because the characteristic polynomialof the sequence is x2 − 5x + 1, with roots r1 and r2, there exist coefficients a1, a2, b1, b2 such thatxk = a1r

k1 +a2r

k2 and yk = b1r

k1 + b2r

k2 . Solving for a1, a2 and b1, b2 using the initial values x0, x1 and

y0, y1 gives the desired answers.

15. Let A be a finite set of positive integers. Prove that there exists a finite set B of positive integerssuch that A ⊆ B and ∏

x∈B

x =∑

x∈B

x2.

Solution: For any finite set S of positive integers, let

D(S) =∏

x∈S

x−∑

x∈S

x2.

If D(A) = 0, then we take B = A. If D(A) < 0, then let m = maxA. Write A′k = A ∪ {m + 1,m +2, . . . ,m + k }. Then there is a positive integer k such that

−D(A) < (m + 1)k − (k3 + 2mk2 + m2k)= (m + 1)k − k(m + k)2 ≤ D(A′k)−D(A)

Page 11: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

Mathematics Olympiad Coachs Seminar, Zhuhai, China 11

and hence D(A′k) > 0. Thus, it suffices to find a finite set B containing A′ such that D(B) = 0,because then B contains A as well. This reduces the problem to the next and final case.

Assume that D(A) > 0, and write A0 = A. Define Ak+1 = Ak ∪{∏

x∈Akx− 1

}recursively for

k = 0, 1, . . . , D(A)− 1. If D(Ak) > 0, we have Ak 6= { 1} and hence

maxAk <∑

x∈Ak

x2 =∏

x∈Ak

x−D(Ak) <∏

x∈Ak

x.

Therefore,∏

x∈Akx− 1 > maxAk and Ak+1 has one more element than Ak. It follows that

D(Ak+1) =∏

x∈Ak+1

x−∑

x∈Ak+1

x2

=∏

x∈Ak

x(∏

x∈Ak

x− 1)−∑

x∈Ak

x2 − (∏

x∈Ak

x− 1)2

=∏

x∈Ak

x−∑

x∈Ak

x2 − 1 = D(Ak)− 1.

Because D(A0) > 0, it follows that D(Ak) = D(A) − k > 0 for k < D(A) and that D(AD(A)) = 0.Taking B = AD(A) completes the proof.

16. Let P (x) be a polynomial with integer coefficients. The integers a1, a2, . . . , an have the followingproperty: for any integer x there exists an 1 ≤ i ≤ n such that P (x) is divisible by ai. Prove thatthere is an 1 ≤ i0 ≤ n such that ai0 divides P (x) for any integer x.

Solution: Assume that the claim is false. Then for each i = 1, 2, . . . , n there exists an integerxi such that P (xi) is not divisible by ai. Hence there is a prime power pki

i which divides ai and doesnot divide P (xi). Some of powers of pk1

i , pk22 , . . . , pkn

n may have the same base. If so, ignore them allbut the one with the least exponent. To simplify the notation, assume the the sequence obtainedthis way is pk1

i , pk22 , . . . , pkm

m , m ≤ n and p1, p2, . . . , pm are distinct. Note that each ai is divisible bysome term of this sequence.

Since pk1i , pk2

2 , . . . , pkmm are pairwise relative prime, the Chinese remainder theorem yields a solu-

tion of the simultaneous congruences

x ≡ x1 (mod pk11 ), x ≡ x2 (mod pk2

1 ), . . . , x ≡ xm (mod pkmm ).

Now since P (x) is an integer polynomial, x ≡ xi (mod pkj

j ) implies that P (x) ≡ P (xi) (mod pkj

j ),for each i = 1, 2, . . . , m. Then none of the numbers pk1

i , pk22 , . . . , pkm

m divided P (x). But each ai isdivisible by p

kj

j for some 1 ≤ j ≤ m, It follows that no ai divides P (x), a contradiction.

17. Determine (with proof) whether there is a subset X of the integers with the following property: forany integer n there is exactly one solution of a + 2b = n with a, b ∈ X.

First Solution: Yes, there is such a subset. If the problem is restricted to the nonnegativeintegers, it is clear that the set of integers whose representations in base 4 contains only the digits0 and 1 satisfies the desired property. To accommodate the negative integers as well, we switch to“base −4”. That is, we represent every integer in the form

∑ki=0 ci(−4)i, with ci ∈ {0, 1, 2, 3} for all

i and ck 6= 0, and let X be the

Page 12: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

12 Zuming Feng ([email protected]), Phillips Exeter Academy, Exeter 03833, USA

set of numbers whose representations use only the digits 0 and 1. This X will again have the desiredproperty, once we show that every integer has a unique representation in this fashion.

To show base −4 representations are unique, let {ci} and {di} be two distinct finite sequences ofelements of {0, 1, 2, 3}, and let j be the smallest integer such that cj 6= dj . Then

k∑

i=0

ci(−4)i 6≡k∑

i=0

di(−4)i (mod 4j),

so in particular the two numbers represented by {ci} and {di} are distinct. On the other hand, toshow that n admits a base −4 representation, find an integer k such that 1 + 42 + · · ·+ 42k ≥ n andexpress n + 4 + · · · + 42k−1 as

∑2ki=0 ci4i. Now set d2i = c2i and d2i−1 = 3 − c2i−1, and note that

n =∑2k

i=0 di(−4)i.

Second Solution: For any S ⊂ Z, let S∗ = {a + 2b| a, b ∈ S}. Call a finite set of integersS = {a1, a2, . . . , am} ⊂ Z good if |S∗| = |S|2, i.e., if the values ai + 2aj (1 ≤ i, j ≤ m) are distinct.We first prove that given a good set and n ∈ Z, we can always find a good superset T of S such thatn ∈ T ∗. If n ∈ S∗ already, take T = S. Otherwise take T = S ∪ {k, n− 2k} where k is to be chosen.Then put T ∗ = S∗ ∪Q ∪R, where

Q = {3k, 3(n− 2k), k + 2(n− 2k), (n− 2k) + 2k}and

R = {k + 2ai, (n− 2k) + 2ai, ai + 2k, ai + 2(n− 2k)| 1 ≤ i ≤ m}.Note that for any choice of k, we have n = (n − 2k) + 2k ∈ Q ⊂ T ∗. Except for n, the new valuesare distinct nonconstant linear forms in k, so if k is sufficiently large, they will all be distinct fromeach other and from the elements of S∗. This proves that T ∗ is good.

Starting with the good set X0 = {0}, we thus obtain a sequence of sets X1, X2, X3, . . . such that foreach positive integer j, Xj is a good superset of Xj−1 and X∗

j contains the jth term of the sequence1,−1, 2,−2, 3,−3, . . . . It follows that

X =∞⋃

j=0

Xj

has the desired property.

18. Suppose the sequence of nonnegative integers a1, a2, . . . , a1997 satisfies

ai + aj ≤ ai+j ≤ ai + aj + 1

for all i, j ≥ 1 with i + j ≤ 1997. Show that there exists a real number x such that an = bnxc for all1 ≤ n ≤ 1997.

Solution: Any x that lies in all of the half-open intervals

In =[an

n,

an + 1n

), n = 1, 2, . . . , 1997

will have the desired property. Let

L = max1≤n≤1997

an

n=

ap

pand U = min

1≤n≤1997

an + 1n

=aq + 1

q.

Page 13: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

Mathematics Olympiad Coachs Seminar, Zhuhai, China 13

We shall prove thatan

n<

am + 1m

,

or, equivalently,man < n(am + 1) (∗)

for all m, n ranging from 1 to 1997. Then L < U , since L ≥ U implies that (∗) is violated whenn = p and m = q. Any point x in [L, U) has the desired property.

We prove (∗) for all m, n ranging from 1 to 1997 by strong induction. The base case m = n = 1is trivial. The induction step splits into three cases. If m = n, then (∗) certainly holds. If m > n,then the induction hypothesis gives (m − n)an < n(am−n + 1), and adding n(am−n + an) ≤ nam

yields (∗). If m < n, then the induction hypothesis yields man−m < (n −m)(am + 1), and addingman ≤ m(am + an−m + 1) gives (∗).

19. Let p be a prime number, and let m and n be integers greater than 1. Suppose that mp(n−1) − 1 isdivisible by n. Show that mn−1 − 1 and n have a common divisor greater than 1.

Solution: For each prime divisor q of n, compute the exponent of p in the prime factorizationof q − 1, and let q0 be a prime for which this quantity is minimized. Let k be the exponent of pin the prime factorization of q0 − 1; then n ≡ 1 (mod pk) and q0 6≡ 1 (mod pk+1). In particular,the greatest common divisor of p(n − 1) and q0 − 1 is divisible by pk but not by pk+1, and so alsodivides n − 1. Therefore, there exist integers r and s so that rp(n − 1) + s(q0 − 1) = n − 1; sincemp(n−1) ≡ mq0−1 ≡ 1 (mod q0), we deduce mn−1 ≡ 1 (mod q0). We conclude that mn−1 − 1 and nhave the common factor q0.

Note: This problem generalizes a problem from MOP 1997: show that 2n−1 ≡ −1 (mod n) for na positive integer only if n = 1. (Set m = p = 2 in the current problem to recover this conclusion.)

20. Starting from a triple (a, b, c) of nonnegative integers, a move consists of choosing two of them, sayx and y, and replacing one of these by either x + y or |x− y|. For example, one can go from (3, 5, 7)to (3, 5, 4) in one move. Prove that there exists a constant r > 0 such that whenever a, b, c, n arepositive integers with a, b, c < 2n, there is a sequence of at most rn moves transforming (a, b, c) into(a′, b′, c′) with a′b′c′ = 0.

Solution: We will use strong induction on n to show that r = 12 works. The bases is trivial.Without loss of generality, we assume that a ≤ b ≤ c. Using two moves if necessary to replace a byc − a and b by c − b, we may instead assume that 0 ≤ a ≤ b ≤ c/2. let m be the integer such that2m−1 ≤ b < 2m. Since 1 ≤ b ≤ c/2 < 2n−1, we have 1 ≤ m ≤ n−1. Define a sequence x0 = a, x1 = b,and xk = xk−1 + xk−2 for k ≥ 2.

Lemma Every integer y ≥ b can be expressed in the form

ε + xii + · · ·+ xi`

where 0 ≤ ε < b and i1 < i2 < · · · < i` and xi` ≤ y < xi`+1.

Proof: Since xi are increasing, there is a unique i ≥ 1 for which xi ≤ y < xi+1. We use stronginduction on i. If y − xi < b, we let ε = y − xi and we are done. Otherwise x1 = b ≤ y − xi <

Page 14: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

14 Zuming Feng ([email protected]), Phillips Exeter Academy, Exeter 03833, USA

xi+1 − xi = xi−1 so there is a unique j ≥ 1 such that xi ≤ y − xi < xj+1, and j < i, so we finish byapplying the inductive hypothesis to y − xi.

Write c = ε + xi1 + · · · + xi` , where 0 ≤ ε < b and 0 < i1 < · · · < i`. Since xk+2 = xk+1 + xk =2xk + xk−1 ≥ 2xk for k ≥ 1, we have

x2n−2m+3 ≥ 2n−m+1x1 ≥ 2n−m+12m−1 = 2n > c,

so i1 < i2 < · · · < i` < 2n− 2m + 3.

Using 2n − 2m + 1 addition moves we can change (a, b, c) = (x0, x1, c) into (x2, x1, c), then into(x2, x3, c), and so on, until we reach (x2n−2m+2, x2n−2m+1, c). If instead intersperse at most 2n−2m+2moves between these to subtract from c the xij in the representation of c as they produced in thefirst two coordinates, we will eventually reduce c to ε. Now we can perform 2n− 2m+1 substractionmoves to change (x2n−2m+2, x2n−2m+1 back to (x2n−2m, x2n−2m+1), and so on, undoing the previousoperations on the first two coordinates, until we end up with the triple a, b, ε).

Reaching (a, b, ε) required at most

2 + (2n− 2m + 1) + (2n− 2m + 2) + (2n− 2m + 1) = 6n− 6m + 6

moves. Afterwards, since a, b, ε < 2m, we can transform (a, b, c) into a triple with a zero in at most12m more moves, by the inductive hypothesis, for a total of (6n−6m+6)+12m = 6n+6m+6, 12mmoves, since m ≤ n− 1.

21. Let S be a set of integers (not necessarily positive) such that

(a) there exist a, b ∈ S with gcd(a, b) = gcd(a− 2, b− 2) = 1;

(b) if x and y are elements of S (possibly equal), then x2 − y also belongs to S.

Prove that S is the set of all integers.

First Solution: In the solution below we use the expression S is stable under x 7→ f(x) tomean that if t belongs to S, then f(t) also belongs to S. If c, d ∈ S, then by condition (b), S isstable under x 7→ c2− x and x 7→ d2− x. Hence, it is stable under x 7→ c2− (d2− x) = x + (c2− d2).Similarly, S is stable under x 7→ x + (d2 − c2). Hence, S is stable under x 7→ x + n and x 7→ x− n,whenever n is an integer linear combination of finitely many numbers in T = { c2 − d2 | c, d ∈ S }.By condition (a), S 6= ∅ and hence T 6= ∅ as well. For the sake of contradiction, assume that somep divides every element in T. Then c2 − d2 ≡ 0 (mod p) for all c, d ∈ S. In other words, for eachc, d ∈ S, either d ≡ c (mod p) or d ≡ −c (mod p). Given c ∈ S, c2 − c ∈ S, by condition (b), soc2 − c ≡ c (mod p) or c2 − c ≡ −c (mod p). Hence,

c ≡ 0 (mod p) or c ≡ 2 (mod p) (∗)

for each c ∈ S. By condition (a), there exist some a and b in S such that gcd(a, b) = 1, that is, atleast one of a or b cannot be divisible by p. Denote such an element of S by α; thus, α 6≡ 0 (mod p).Similarly, by condition (a), gcd(a−2, b−2) = 1, so p cannot divide both a−2 and b−2. Thus, thereis an element of S, call it β, such that β 6≡ 2 (mod p). By (∗), α ≡ 2 (mod p) and β ≡ 0 (mod p).By condition (b), β2 − α ∈ S. Taking c = β2 − α in (∗) yields either −2 ≡ 0 (mod p) or −2 ≡ 2(mod p), so p = 2. Now (∗) says that all elements of S are even, contradicting condition (a). Hence,our assumption is false and no prime divides every element in T.

Page 15: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

Mathematics Olympiad Coachs Seminar, Zhuhai, China 15

It follows that T 6= { 0}. Let x be an arbitrary nonzero element of T. For each prime divisor of x,there exists an element in T which is not divisible by that prime. The set A consisting of x and eachof these elements is finite. By construction, m = gcd{ y | y ∈ A } = 1, and m can be written asan integer linear combination of finitely many elements in A and hence in T. Therefore, S is stableunder x 7→ x + 1 and x 7→ x− 1. Because S is nonempty, it follows that S is the set of all integers.

Second Solution: Define T, a, and b as in the first solution. We present another proof thatno prime divides every element in T. Suppose, for sake of contradiction, that such a prime p doesexist. By condition (b), a2 − a, b2 − b ∈ S. Therefore, p divides a2 − b2, x1 = (a2 − a)2 − a2, andx2 = (b2− b)2− b2. Because gcd(a, b) = 1, both gcd(a2− b2, a3) and gcd(a2− b2, b3) equal 1, so p doesnot divide a3 or b3. But p does divide x1 = a3(a− 2) and x2 = b3(b− 2), so it must divide a− 2 andb − 2. Because gcd(a − 2, b − 2) = 1 by condition (a), this implies p | 1, a contradiction. Thereforeour original assumption was false, and no such p exists.

22. For a set S, let |S| denote the number of elements in S. Let A be a set of positive integers with|A| = 2001. Prove that there exists a set B such that

(i) B ⊆ A;

(ii) |B| ≥ 668;

(iii) for any u, v ∈ B (not necessarily distinct), u + v 6∈ B.

First Solution: (By Reid Barton) For a positive integer n, let Zn denote the set of residuesmodulo n. Let φ(n) be the Euler function which is defined to be the number of integers between1 and n relatively prime to n. Call a set A of residues modolo 3n sum-free if for any a, b ∈ A, a + bis not (congruent to) an element of A.

Lemma. For any n ≥ 1, there exist 3n − 1 sum-free sets of 3n−1 residues modulo 3n such thatevery nonzero residue modulo 3n appears in exactly 3n−1 of the subsets.

Proof: We construct the desired subsets inductively. For n = 1 we take the sets { 1} and { 2}.Let n ≥ 1, and suppose that the statement holds for n, that is, we have 3n − 1 sum-free subsets A1,A2, . . . , A3n−1 of Z3n such that every element of Z3n belongs to exactly 3n−1 of the Ai. Constructsets B1, B2, . . . , B3n−1 by

Bi = {x ∈ Z3n+1‖x ≡ m′ (mod 3)n, m′ ∈ Ai }.

Then each Bi contains 3|Ai| = 3n residues, and the Bi are sum-free, because if a, b ∈ Bi, (a+b) mod 3n

is not in Ai so a + b is not in Bi. Moreover, each element x of Z3n+1 which is not 0 modulo 3n (i.e.,all elements except 0, 3n, 2 · 3n) is in exactly 3n−1 of the Bi, namely those corresponding to the Ai

containing x mod 3n.

Now define setsC = { 3n, 3n + 1, . . . , 2 · 3n − 1 }

andU = {x ∈ Z3n+1‖ gcd(x, 3) = 1 }.

Then C ⊂ Z3n+1 , |C| = 3n. Note that C is sum-free, because if a, b ∈ C with 3n ≤ a, b < 2 · 3n then2 · 3n ≤ a + b < 4 · 3n so a + b is not congruent modulo 3n+1 to an element of C. For each y ∈ U , letCy = yC = { yx‖x ∈ C }. Then Cy is also sum-free for every y ∈ U , because if we had ya and yb in

Page 16: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

16 Zuming Feng ([email protected]), Phillips Exeter Academy, Exeter 03833, USA

Cy with ya+yb ∈ Cy, then a and b would be elements of C summing to an element of C. Also, everyCy contains |C| = 3n residues because multiplication by y is invertible. Since |U | = φ(3n+1) = 2×3n,there are 2 · 3n of sets Cy’s.

Consider the sets

B1, B2, . . . , B3n−1, C1, C2, C4, C5, C7, . . . , C3n+1−2, C3n+1−1.

There are 3n − 1 + 2 · 3n = 3n+1 − 1 of these sets, so it suffices to check that every nonzero residuemodulo 3n+1 appears in exactly 3n of them. Let m be a nonzero residue modulo 3n+1, and writem = 3ks, 0 ≤ k ≤ n, gcd(s, 3) = 1. We consider two cases.

(i) k < n. Then m is a nonzero residue modulo 3n, so m is contained in exactly 3n−1 of thesets Bi, namely those which correspond to Ai with m′ ∈ Ai (where m ≡ m′ (mod 3)n). Thenumber of sets Ci containing m is the number of solutions to y−1m ∈ C with y ∈ U , or thenumber of z ∈ U such that zm ∈ C. Since m 6= 0, as z ranges over Z3n+1 , one third of theresidues zm are in C; likewise, since 3m 6= 0, one third of the residues 3zm are in C. SinceU = Z3n+1 \ 3Z3n+1 , zm ∈ C for one third of the values z ∈ U . So m is in one third of the setsCy, giving 1

3 |U | = 2 · 3n−1 more sets containing m. The total number of sets containing m isthen 3n−1 + 2 · 3n−1 = 3n.

(ii) k = n. Then m = 3n or 2 · 3n (s = 1 or 2 respectively). Then m mod 3n = 0, so m does notappear in any of the sets Ai. However, m appears in every set Cy with y ≡ s (mod 3), so mappears in 3n of the Cy. Thus the total number of sets containing m is again 3n.

Thus the sets {Bi}, {Cy} have the desired properties and the Lemma holds by induction.

Now let 3n be a power of 3 larger than the sum of any two elements of A. By the Lemma, thereexist 3n − 1 sets S1, . . . , S3n−1 of 3n−1 residues modulo 3n such that every nonzero residue modulo3n appears in exactly 3n−1 of the Si. Let ni be the number of elements of A contained in Si. Sinceevery element of A appears 3n−1 times,

3n−1∑

i=1

ni = 3n−1|A|

so some ni is at least3n−1|A|3n − 1

>13|A| = 2001

3= 667.

Let B be the set of elements of A contained in Si. Then |B| ≥ 668, and if u, v ∈ B, then u + v /∈ B,because Si is sum-free. Thus the set B has the desired properties.

Second Solution: Let the elements of A be a1, . . . , a2001. Let p be a prime number such thatp ≡ 2 (mod 3) and p is larger than all the ai. Such a prime p exists by Dirichlet’s Theorem,although the result can also be easily proven directly. There is at least one prime congruent to 2modulo 3 (namely, 2). Suppose there were only finitely many primes congruent to 2 modulo 3, andlet their product be P . Then 3P − 1, which is larger than P and congruent to 2 modulo 3, musthave another prime divisor congruent to 2 modulo 3, contradiction. Thus, the original assumptionwas wrong, and there are infinitely many odd primes that are congruent to 2 modulo 3. Specifically,one such prime is larger than all ai.

Page 17: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

Mathematics Olympiad Coachs Seminar, Zhuhai, China 17

All elements of S are distinct and nonzero modulo p. Call a number n mediocre if the least positiveresidue of n modulo p lies in [(p + 1)/3, (2p− 1)/3]. For any 1 ≤ i ≤ 2001, there are exactly (p+1)/3integer values of k ∈ [1, p− 1] such that kai is mediocre. Thus, there are

2001(p + 1)3

= 667(p + 1)

pairs of (k, i) such that kai is mediocre. By the Pigeonhole Principle, there exists some k forwhich the set

B = { ai | kai is mediocre }has at least 668 elements.

We now claim that this B satisfies the desired properties. It suffices to show that k times the sumof any two elements of B is not mediocre and hence cannot equal k times any element of B. Tothat end, note that k times the sum of any two elements of B cannot be mediocre because it iscongruent modulo p to some number in [2(p + 1)/3, 2(2p− 1)/3] or, equivalently, to some number in[0, (p− 2)/3] ∪ [(2p + 2)/3, p− 1], which is a set containing no mediocre numbers. Thus, the set Bsatisfies the desired properties.

23. For a given prime p, find the greatest positive integer n with the following property: the edges of thecomplete graph on n vertices can be colored with p + 1 colors so that:

(a) at least two edges have different colors;

(b) if A,B, and C are any three vertices and the edges AB and AC are of the same color, then BChas the same color as well.

Solution: Let n be a number having the given property, and let edges of the complete graphwith n vertices be colored in p + 1 colors denoted 1, 2, . . . , p + 1 so that the given conditions hold.Consider an arbitrary vertex A1. Denote by xi the number of edges with endpoint A1 colored in thecolor i. Then, of course,

x1 + x2 + · · ·+ xp+1 = n− 1. (1)

Invoking the Pigeonhole principle, we are going to show that

xi ≤ p− 1 for each i = 1, 2, . . . p + 1. (2)

Assume (2) is not true. Without loss of generality, let the edges A1A2, A1A3, . . . A1Ap+1 be of theith color. Then, according (b), each of he edges AkA`, 2 ≤ k < ` ≤ p + 1, is of the ith color as well.Take any vertex B of the graph. At least one of the p + 1 edges BA1, BA2, . . . , BAp+1 is of the ith

color: otherwise, one of the other p colors would double up, making two edges BAk and BA` boththe same color m 6= i. But then (b) imply that AkA` is of the mth color, a contradiction.

Thus the edge BAj is of the ith color for some j = 1, 2, . . . , p + 1. Then since BAj and AjAk are ofcolor i, it follows that BAk is also in color i, and this is true for all k = 1, 2, . . . , p + 1. The vertex Bwas chosen arbitrarily, so the same result applies to any other vertex C. Then using (b) for the lasttime, we obtain that any edge BC is of the ith color, and this contradicts (a).

Thus we proved (2) which, combined with (1), gives

n− 1 = x1 + x2 + · · ·+ xp+1 ≤ (p + 1)(p− 1) = p2 − 1.

This means n ≤ p2. Note that this conclusion holds regardless of whether or not p is a prime.

Page 18: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

18 Zuming Feng ([email protected]), Phillips Exeter Academy, Exeter 03833, USA

The Pigeonhole principle did its job. Now we have to point out an example proving that the edgesof the complete graph G with p2 vertices can be colored in p + 1 colors so that (a) and (b) hold.The construction is indeed a very nice one. Regard the vertices of G as ordered pairs (i, j) where0 ≤ i, j ≤ p−1. Let A1 = (a1, b1) and A2 = (a2, b2) be vertices of G. if b1 6= b2, then gcd(b1−b2, p) = 1as p is a prime. Then the congruence

(b1 − b2)x = a1 − a2 (mod p)

has a unique solution x = i in the set {0, 1, 2, . . . , p − 1}. In this case, color edges A1A2 with colori + 1. If b1 = b2, then color this edge with color p + 1. Thus the edges of G are colored with p + 1edges. The condition (a) holds for trivial reasons, and (b) follows from the transitive property ofcongruence.

Hence the greatest number with the desired property is p2.

24. Let p > 2 be a prime and let a, b, c, d be integers not divisible by p, such that

{ra/p}+ {rb/p}+ {rc/p}+ {rd/p} = 2

for any integer r not divisible by p. Prove that at least two of the numbers a + b, a + c, a + d, b + c,b + d, c + d are divisible by p. (Note: {x} = x− bxc denotes the fractional part of x.)

Solution: For convenience, we write [x] for the unique integer in {0, . . . , p − 1} congruent tox modulo p. In this notation, the given condition can be written

[ra] + [rb] + [rc] + [rd] = 2p for all r not divisible by p. (1)

The conditions of the problem are preserved by replacing a, b, c, d with ma,mb,mc, md for any integerm relatively prime to p. If we choose m so that ma ≡ 1 (mod p) and then replace a, b, c, d with[ma], [mb], [mc], [md], respectively, we end up in the case a = 1 and b, c, d ∈ {1, . . . , p− 1}. Applying(1) with r = 1, we see moreover that a + b + c + d = 2p.

Now observe that

[(r + 1)x]− [rx] ={

[x] [rx] < p− [x]−p + [x] [rx] ≥ p− [x].

Comparing (1) applied to two consecutive values of r and using the observation, we see that for eachr = 1, . . . , p− 2, two of the quantities

p− a− [ra], p− b− [rb], p− c− [rc], p− d− [rd]

are positive and two are negative. We say that a pair (r, x) is positive if [rx] < p− [x] and negativeotherwise; then for each r < p−1, (r, 1) is positive, so exactly one of (r, b), (r, c), (r, d) is also positive.

Lemma If r1, r2, x ∈ {1, . . . , p− 1} have the property that (r1, x) and (r2, x) are negative but (r, x)is positive for all r1 < r < r2, then

r2 − r1 =⌊p

x

⌋or r2 − r1 =

⌊p

x

⌋+ 1.

Proof: Note that (r′, x) is negative if and only if {r′x + 1, r′x + 2, . . . , (r′ + 1)x} contains a multipleof p. In particular, exactly one multiple of p lies in {r1x, r1x + 1, . . . , r2x}. Because [r1x] and [r2x]are distinct elements of {p− [x], . . . , p− 1}, we have

p− x + 1 < r2x− r1x < p + x− 1,

Page 19: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

Mathematics Olympiad Coachs Seminar, Zhuhai, China 19

from which the lemma follows.

[rx] 9 10 0 1 2 3 4 5 6 7 8 9 10 0is (r, x) + or –? − + + + −

r 3 4 5 6 7

(The above diagram illustrates the meanings of positive and negative in the case x = 3 and p = 11. Note thatthe difference between 7 and 3 here is b p

xc+ 1. The next r such that (r, x) is negative is r = 10; 10− 7 = b pxc.)

Recall that exactly one of (1, b), (1, c), (1, d) is positive; we may as well assume (1, b) is positive,which is to say b < p

2 and c, d > p2 . Put s1 = bp

b c, so that s1 is the smallest positive integer suchthat (s1, b) is negative. Then exactly one of (s1, c) and (s1, d) is positive, say the former. Because s1

is also the smallest positive integer such that (s1, c) is positive, or equivalently such that (s1, p − c)is negative, we have s1 = b p

p−cc. The lemma states that consecutive values of r for which (r, b) isnegative differ by either s1 or s1 + 1. It also states (when applied with x = p − c) that consecutivevalues of r for which (r, c) is positive differ by either s1 or s1 + 1. From these observations we willshow that (r, d) is always negative.

r 1 s1 s1 + 1 s′ s′ + 1 s s + 1 ?= t

(r, b) + − + − + − −?

(r, c) − . . . + − . . . + − . . . − +?

(r, d) − − − − − + −?

Indeed, if this were not the case, there would exist a smallest positive integer s > s1 such that (s, d)is positive; then (s, b) and (s, c) are both negative. If s′ is the last integer before s such that (s′, b) isnegative (possibly equal to s1), then (s′, d) is negative as well (by the minimal definition of s). Also,

s− s′ = s1 or s− s′ = s1 + 1.

Likewise, if t were the next integer after s′ such that (t, c) were positive, then

t− s′ = s1 or t− s′ = s1 + 1.

From these we deduce that |t − s| ≤ 1. However, we can’t have t 6= s because then both (s, b) and(t, b) would be negative — and any two values of r for which (r, b) is negative differ by at leasts1 ≥ 2, a contradiction. (The above diagram shows the hypothetical case when t = s + 1.) Nor canwe have t = s because we already assumed that (s, c) is negative. Therefore we can’t have |t− s| ≤ 1,contradicting our findings and thus proving that (r, d) is indeed always negative.

Now if d 6= p − 1, then the unique s ∈ {1, . . . , p − 1} such that [ds] = 1 is not equal to p − 1; and(s, d) is positive, a contradiction. Thus d = p− 1 and a + d and b + c are divisible by p, as desired.

25. For real number x, let dxe denote the smallest integer greater than or equal to x, let bxc denote thegreatest integer less than or equal to x, and let {x} denote the fractional part of x, which is givenby x− bxc. Let p be a prime number. For integers r, s such that rs(r2 − s2) is not divisible by p, letf(r, s) denote the number of integers n ∈ {1, 2, . . . , p − 1} such that {rn/p} and {sn/p} are eitherboth less than 1/2 or both greater than 1/2. Prove that there exists N > 0 such that for p ≥ N andall r, s, ⌈

p− 13

⌉≤ f(r, s) ≤

⌊2(p− 1)

3

⌋.

Page 20: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

20 Zuming Feng ([email protected]), Phillips Exeter Academy, Exeter 03833, USA

Solution: We assume that p is sufficiently large. Since f(r, s) = f(br, bs) for any b not divisible byp, we may assume r = 1 and simply write f(s) instead of f(r, s). Also notice that f(s) = p−1−f(−s),so we may assume 1 ≤ s ≤ (p − 1)/2. Moreover, s = 1 is forbidden, f(2) = (p − 1)/2 or (p − 3)/2,and one easily checks that f(3) = b2(p− 1)/3c. So we may assume s ≥ 4.

Let g1(s) be the number of a ∈ {1, . . . , (p − 1)/2} such that {as/p} < 1/2; and let g2(s) be thenumber of a ∈ {(p + 1)/2, . . . , p− 1} such that {as/p} > 1/2. Note that

{as/p}+ {(p− a)s/p} = 1.

Thus g1(s) = g2(s) = f(s)/2. We consider two cases.

(a) s ∈ [4, p/4]. Note that∣∣∣∣f(s)− p− 1

2

∣∣∣∣ =∣∣∣∣g1(s)−

(p− 1

2− g1(s)

)∣∣∣∣ ≤s

2+

p

2s.

To see this, divide s, 2s, . . . , (p−1)s/2 into groups depending on which of the intervals (0, p), (p, 2p), . . .they fall into. In each group except the last one, at most one more number falls into one halfof the interval than into the other half. Since the largest of these numbers is less than sp/2,the number of such groups is at most s/2. In the last group, the maximum discrepancy is thegreatest quantity of the numbers that fit into one half of the interval, which is at most p/2s.For s ∈ [4, p/4], the right side of the above inequality achieves its maximum value at theendpoints of the interval. Thus we get the upper bound

∣∣∣∣f(r, s)− p− 12

∣∣∣∣ ≤ 2 +p

8

and the right side is less than (p− 1)/6 for p sufficiently large.

(b) s ∈ ((p − 1)/4, (p − 1)/2]. In this case, there cannot exist three consecutive values of a ∈{1, . . . , (p − 1)/2} or three consecutive values of a ∈ {(p + 1)/2, . . . , p − 1} such that the threevalues of {as/p} all lie in a single interval of length 1/2. For p ≡ 1 (mod 6) this impliesd(p − 1)/3e ≤ f(s) ≤ b2(p − 1)/3c; for p ≡ 5 (mod 6), the lower bound is true. To violate theupper bound, f(s) ≥ 4k + 3 where p = 6k + 5. Since f(s) = 2g2(s), g2(s) ≥ 2k + 2. But we canregroup 3k + 2 numbers {1, 2, . . . , (p− 1)/2} as

{(1, 2), (3, 4, 5), . . . , (3k, 3k + 1, 3k + 2)}︸ ︷︷ ︸k+1 groups

.

From the earlier observation, each group can provide at most two a’s such that {as/p} < 1/2.Hence {s/p}, {2s/p} < 1/2. Since 1 ≤ s ≤ (p− 1)/2, {2s/p} = 2s/p. But then s/p < 1/4 and4s < p. Now p > 4s > p− 1, which is impossible for integers s and p.

Note: Paul Valiant noted that one can alternatively treat the case s > (p − 1)/4 by a morecareful analysis of the group sizes, particularly in the neighborhood of (p− 1)/3.

The assertion of the problem holds in fact for all p ≥ 5 (note that the assertion is vacuous for p = 2, 3);furthermore, equality holds if and only if r ≡ ±3s (mod p) or s ≡ ±3r (mod p).

The result is the main step in the solution of the following problem, posed recently by Greg Martin.Fix a prime number p. I choose 3 integers a1, a2, a3 not divisible by p and no two congruent modulo

Page 21: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

Mathematics Olympiad Coachs Seminar, Zhuhai, China 21

p. You then choose an integer r not divisible by p, and then collect from me a number of dollarsequal to the smallest positive integer congruent to one of ra1, ra2, ra3 modulo p. What is the smallestamount I will have to pay out, and how do I achieve this minimum? (The corresponding questionfor k integers instead of 3 is open, and the proposer offers $15 for its solution.)

26. Is it possible to select 102 17-element subsets of a 102-element set, such that the intersection of anytwo of the subsets has at most 3 elements?

Solution: The answer is “yes.” More generally, suppose that p is a prime congruent to 2 modulo3. We show that it is possible to select p(p+1)/3 p-element subsets of a p(p+1)/3-element set, suchthat the intersection of any two of the subsets has at most 3 elements. Setting p = 17 yields theclaim.

Let P be the projective plane of order p (which this solution refers to as “the projective plane,” forshort), defined as follows. Let A be the ordered triples (a, b, c) of integers modulo p, and define theequivalence relation ∼ by (a, b, c) ∼ (d, e, f) if and only if (a, b, c) = (dκ, eκ, fκ) for some κ. Thenlet P = (A− {(0, 0, 0)}) /∼. We let [a, b, c] ∈ P denote the equivalence class containing (a, b, c), andwe call it a point of P. Because A− {(0, 0, 0)} contains p3 − 1 elements, and each equivalence classunder ∼ contains p− 1 elements, we find that |P| = (p3 − 1)/(p− 1) = p2 + p + 1.

Given q ∈ P, we may write q = [α, β, γ] and consider the solutions [x, y, z] to

αx + βy + γz ≡ 0 (mod p).

The set of these solutions is called a line in the projective plane; it is easy to check that this line iswell-defined regardless of how we write q = [α, β, γ], and that (x, y, z) satisfies the above equation ifand only if every triple in [x, y, z] does. We let [[α, β, γ]] denote the above line.

It is easy to check that P is in one-to-one correspondence with P∗, the set of lines in the projectiveplane, via the correspondence [α, β, γ] ←→ [[α, β, γ]]. It is also easy to check that any two distinctpoints lie on exactly one line, and that any two distinct lines intersect at exactly one point. Fur-thermore, any line contains exactly p + 1 points. (The projective plane is not an invention of thissolution, but a standard object in algebraic geometry; the properties described up to this point arealso well known.)

Define ϕ : P → P by ϕ([a, b, c]) = [b, c, a]. Given a point q ∈ P, we say we rotate it to obtain q′ ifq′ = ϕ(q). Similarly, given a subset T ⊆ P, we say we rotate it to obtain T ′ if T ′ = ϕ(T ).

Given a point q 6= [1, 1, 1] in the projective plane, we rotate it once and then a second time to obtaintwo additional points. Together, these three points form a triplet. We will show below that (i) thecorresponding triplet actually contains three points. Observe that any two triplets obtained in thismanner are either identical or disjoint. Because there are p2 + p points in P − {[1, 1, 1]}, it followsthat there are p(p + 1)/3 distinct triplets. Let S be the set of these triplets.

Given a line ` = [[α, β, γ]] 6= [[1, 1, 1]] in the projective plane, it is easy to show that rotating it onceand then a second time yields the lines [[β, γ, α]] and [[γ, α, β]]. The points q 6= [1, 1, 1] on [[α, β, γ]],[[β, γ, α]], and [[γ, α, β]] can be partitioned into triplets. More specifically, we will show below that(ii) there are exactly 3p such points q 6= [1, 1, 1]. Hence, these points can be partitioned into exactlyp distinct triplets; let T` be the set of such triplets.

Take any two lines `1, `′1 6= [[1, 1, 1]], and suppose that |T`1 ∩ T`′1 | > 3. We claim that `1 and `′1 are

rotations of each other. Suppose otherwise for sake of contradiction. Let `2, `3 be the rotations of `1,and let `′2, `

′3 be the rotations of `′1. We are given that T`1 and T`′1 share more than three triplets;

Page 22: 118296096 Zuming Feng Number Theory Mathematics Olympiad Coachs Seminar Coachnums Some Solutions 2004 22p

22 Zuming Feng ([email protected]), Phillips Exeter Academy, Exeter 03833, USA

that is, `1 ∪ `2 ∪ `3 intersects `′1 ∪ `′2 ∪ `′3 in more than 9 points. Because `1 and `′1 are not rotationsof each other, each `i is distinct from all the `′j . Hence, `i ∩ `′j contains exactly one point for each iand j. It follows that `1 ∪ `2 ∪ `3 and `′1 ∪ `′2 ∪ `′3 consists of at most 3 · 3 = 9 points, a contradiction.Hence, our assumption as wrong, and |T`1 ∩ T`′1 | > 3 only if `1 and `′1 are rotations of each other.

Just as there are p(p+1) points in P −{[1, 1, 1]}, there are p(p+1) lines in P∗−{[[1, 1, 1]]}. We canpartition these into p(p + 1)/3 triples (`1, `2, `3), where the lines in each triple are rotations of eachother. Now, pick one line ` from each triple and take the corresponding set T` of triplets. From theprevious paragraph, any two of these p(p + 1)/3 sets intersect in at most 3 triplets.

Hence, we have found a set S of p(p+1)/3 elements (namely, the triplets of P), along with p(p+1)/3subsets of S (namely, the appropriate T`) such that no two of these subsets have four elements incommon. This completes the proof.

Well, not quite. We have yet to prove that (i) if q 6= [1, 1, 1], then the triplet {q, ϕ(q), ϕ2(q)} containsthree distinct points, and (ii) if `1 = [[α, β, γ]] 6= [[1, 1, 1]], then there are 3p points q 6= [1, 1, 1] on[[α, β, γ]] ∪ [[β, γ, α]] ∪ [[γ, α, β]].

To prove (i), we first show that x3 ≡ 1 (mod p) only if x ≡ 1 (mod p). Because 3 is coprime to p− 1,we can write 1 = 3r + (p− 1)s. We are given that x3 ≡ 1 (mod p), and by Fermat’s Little Theoremwe also have xp−1 ≡ 1 (mod p). Hence,

x = x3r+(p−1)s =(x3

)r (xp−1

)s ≡ 1r · 1s ≡ 1 (mod p).

(Alternatively, let g be a primitive element modulo p, and write x = gm for some nonnegative integerm. Then

1 ≡ (gm)3 = g3m (mod p),

implying that p − 1 divides 3m. Because p − 1 is relatively prime to 3, we must have (p − 1) | m.Writing m = (p− 1)n, we have x ≡ gm ≡ (gp−1)n ≡ 1 (mod p).)

Now, if q = [a, b, c] 6= [1, 1, 1], then suppose (for sake of contradiction) that [a, b, c] = [b, c, a]. Thereexists κ such that (a, b, c) = (bκ, cκ, aκ). Thus,

ab−1 ≡ bc−1 ≡ ca−1 (mod p),

because all three quantities are congruent to κ modulo p. Hence, (ab−1)3 ≡ (ab−1)(bc−1)(ca−1) ≡1 (mod p). From this and the result in the last paragraph, we conclude that ab−1 ≡ 1 (mod p). There-fore, a ≡ b (mod p), and similarly b ≡ c (mod p) — implying that [a, b, c] = [1, 1, 1], a contradiction.

Next, we prove (ii). Let `1 = [[α, β, γ]] 6= [[1, 1, 1]], `2 = [[β, γ, α]], and `3 = [[γ, α, β]]. Because[[α, β, γ]] 6= [[1, 1, 1]], we know (from a proof similar to that in the previous paragraph) that `1, `2, `3

are pairwise distinct. Hence, any two of these lines intersect at exactly one point. We consider twocases: `1 and `2 intersect at [1, 1, 1], or they intersect elsewhere.

If [1, 1, 1] lies on `1 and `2, then it lies on `3 as well. Each line contains p + 1 points in total andhence p points distinct from [1, 1, 1]. Counting over all three lines, we find 3p points distinct from[1, 1, 1]; these points must be distinct from each other, because any two of the lines `i, `j intersect atonly [1, 1, 1].

If instead q0 = `1 ∩ `2 is not equal to [1, 1, 1], then [1, 1, 1] cannot lie on any of the lines `1, `2, `3.We have ϕ(q0) = `2 ∩ `3 and ϕ2(q0) = `3 ∩ `1; because q0 6= [1, 1, 1], the three intersection pointsq0, ϕ(q0), ϕ2(q0) are pairwise distinct. Now, each of the three lines `1, `2, `3 contains p + 1 points (alldistinct from [1, 1, 1]), for a total of 3p + 3 points. However, we count each of q0, ϕ(q0), ϕ2(q0) twicein this manner, so in fact we have (3p + 3) − 3 = 3p points on `1 ∪ `2 ∪ `3 − {[1, 1, 1]}, as desired.This completes the proof.