MONT

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

2. Modular Arithmetic Basics 2.

Modular Arithmetic Basics

2.13 Example Problems Proof. We know that 9|34!. Also we know from the rule of divisibility by 9 that for all
naturals n, n ≡ S(n) (mod 9), where S(n) is the sum of digits of n. Hence, 9|a + b + 136
I will try to cover a variety of problems in this section. Some may be clever, some may be and so a + b ∈ {8, 17}, as 0 ≤ a, b ≤ 9.
boring problems with not much insight. However, you should learn to face the truth! We also know that 11|34!. Also, a number modulo 11 is congruent to the alternating sum
of the digits in the number, read from left to right. Therefore, 11|(77+a)−(59+b) = 18+a−b
Example 2.13.1 (USAMO 1991/3) and so a − b ∈ {−7, 4} as 0 ≤ a, b ≤ 9.
Show that, for any fixed integer n ≥ 1, the sequence Now, note that a + b and a − b have the same parity. Hence, the only possibilities are
(a + b, a − b) = (8, 4) and (17, −7), and the two cases yield (a, b) = (6, 2) or (a, b) = (5, 12),
2 22
2, 22 , 22 , 22 , . . . (mod n) respectively. But since a, b ≤ 9, hence the second case is impossible. Thus, (a, b) = (6, 2)
proving the claim.
is eventually constant.
(The tower of exponents is defined by a1 = 2, ai+1 = 2ai . In other terms, we start Another example where modular constraints help us bound things:
22 4
working from the top, for instance 22 = 22 = 216 = 65536.)
Example 2.13.3 (St. Petersburg 2008)
For convenience, define ai to be the ith term of the sequence. Firstly, assume n is odd. Given three distinct natural a, b, c show that
Since 2ϕ(n) ≡ 1 (mod n), hence if we can ak ≡ ak+1 ≡ ak+2 ≡ . . . (mod ϕ(n)) for some k,
we would get a+b+c
gcd(ab + 1, bc + 1, ca + 1) ≤
2ak ≡ |2a{z
|{z}
k+1 ak+2
} ≡ |2 {z } ≡ . . . (mod n), 3
=ak+1 =ak+2 =ak+3

which is what we want. So if we can show if the sequence hai i eventually becomes constant Proof. Suppose d = gcd(ab+1, bc+1, ca+1). Then ab, bc, ca ≡ −1 (mod d), and so ab−bc =
modulo ϕ(n), we can conclude that it eventually becomes constant modulo n as well. So we b(a − c) ≡ 0 (mod d). Now if b, d have a common factor, say p > 1, then p | d | ab + 1.
have to prove the same problem for ϕ(n) instead. Combining with p | b, we get p | ab + 1 − b(a) = 1, a contradiction. Hence b, d are coprime
The key observation now is ϕ(n) < n. So we have reduced the problem from case n to a and so d | a − c.
smaller case. Hence, we can use (strong) induction! Here’s how it goes: Similarly, d | a − b, b − c. Thus, a ≡ b ≡ c (mod d). Now, assume without loss of
generality that a > b > c (strict inequalities since they are given to be distinct). Hence
Proof. Check the base case of n = 1, and assume the result till some n − 1. If n is odd, we
a ≥ b + d ≥ c + 2d. So
can reduce the problem to smaller case ϕ(n), for which it is true by the induction hypothesis.
We just have to manage n even now. In this case, we try to eliminate the ”even part” of n a+b+c
and work. So if n = 2m n∗ with n∗ odd, then pick k large enough such that ak > m. So a + b + c ≥ 3a + 3d ≥ 3d =⇒ ≥ d.
3
2ak ≡ 2ak+1 (mod n) ⇔ 2ak −m ≡ 2ak+1 −m (mod n∗ ) Hence we are done.

and again use the induction hypothesis as n∗ < n (here we used the result from Example Not all problems are nice and sweet, some may involve simple ideas with which you work
2.12.2). a lot, typically means a lot of case work. For instance the following:

Sometimes, simple modular considerations can be useful: Example 2.13.4 (Azerbaijan Balkan Math Olympiad Third TST 2015)

Example 2.13.2 Find all natural numbers n for which there exist primes p and q such that the following
conditions are satisfied:
Given
34! = 295232799039a041408476186096435b0000000, 1. p + 2 = q, and

in decimal representation, find the numbers a and b. 2. 2n + p and 2n + q are both primes

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 66 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 67
2. Modular Arithmetic Basics 2. Modular Arithmetic Basics

Proof. We will show that such primes exist if and only if n ∈ {1, 3}. By these conditions, a contradiction.
we have that (p, p + 2, p + 2n , p + 2n + 2) are all primes. This means that 3|r. Write r = 3s for some integer s so that n = 12s + 3. Thus,
Clearly, p 6= 2 because else q = 4, which is not a prime. Let us assume for the moment
that p 6= 3. Thus, p ≥ 5. 5 + 2n = 5 + 212s+3
s
n n
1. If n is even, then (p, p + 2, p + 2 , p + 2 + 2) ≡ (p, p + 2, p + 1, p) (mod 3) and so at = 5 + 8 · 212
least one of p, p + 2, or p + 2n is divisible by 3. This is clearly false since we assumed ≡ 5 + 8 ≡ 0 (mod 13),
these numbers are primes and p ≥ 5.
a contradiction.
2. If n is odd, then (p, p + 2, p + 2n , p + 2n + 2) ≡ (p, p + 2, p + 2, p + 1) (mod 3) and so at
least one of p, p + 2, or p + 2n + 2 is divisible by 3, and since they are all primes, one Hence, we have exhausted all the possibilities and so n = 1 and n = 3 are the only
of them must be 3. This is again a contradiction because we assumed p ≥ 5. possible solutions.

Hence, we must have p = 3 and (3 + 2n , 5 + 2n ) is a pair of primes. It is easy to see that Finally, we look at an amazing combinatorial-number theory problem. Euclid gave a
this condition is satisfied for n = 1 and n = 3 but not for n = 2. We will show that there is construction for showing the infinitude of primes. Somebody made a problem out of that
no n > 3 that satisfies this condition. First, notice that if n > 3, then construction.
5 + 2n > 3 + 2n > 13. Example 2.13.5
If n is even, say n = 2z, then 5 + 2n = 5 + 4z ≡ 5 + 1 ≡ 0 (mod 3), but since 5 + 2n > 3, Let P be the set of all prime numbers over naturals. Let M be a subset of P with at
this number cannot be a prime, a contradiction. Thus, n is odd. Set n = 2k + 1 for some least 3 elements. Choose any proper subset A of M. Consider the number
integer k. Y
If k is even, then nA := −1 + p
p∈A
3 + 2n = 3 + 2 · 2n−1 = 3 + 2 · 4k
≡ 3 + 2 · (−1)k Suppose that any prime divisor of nA lies in M for all A ⊂ M.
≡ 3 + 2 ≡ 0 (mod 5), Show that M ≡ P.
which is a contradiction because 3 + 2n > 5. So, k is odd. Set k = 2r + 1 for some integer We start by trying to manually show each prime is in M, at least for as many primes as
r, and so n = 4r + 3. we can. Firstly, M has at least 3 elements. So choose an odd prime p ∈ M. Then n{p} is
If r ≡ 1 (mod 3), write r = 3z + 1. Then, we have even and so 2 ∈ M.
5 + 2n = 5 + 24r+3 = 5 + 8 · 16r Next, if a prime p of the form 3k + 1 lies in M, then n{p} is divisible by 3. Otherwise
≡ 5 + 2r there exists a prime p of the form 3k + 2 and so n{2,p} = −1 + 2p is divisible by 3. Thus, in
≡ 5 + 23z+1 either case we get that 3 ∈ M.
≡ 5 + 2 · 8z Then n{2,3} = 5 implies that 5 ∈ M. Also, n{3,5} =⇒ 7 ∈ M. The problem has the same
≡ 5 + 2 ≡ 0 (mod 7), construction as that of Euclid’s. So this problem is screaming at us to try to do what he
did, show that the ”set” is infinite; in case the set of primes, and in our case the set M.
and we get a similar contradiction to the ones previous cases.
Claim. M is an infinite set
If r ≡ 2 (mod 3), say r = 3z + 2, then
Proof. Assume on the contrary, and set M = {p1 , p2 , · · · pn }. We can’t directly consider nM
3 + 2n = 3 + 24r+3 = 3 + 8 · 16r since the subset we choose must be a proper subset.
≡ 3 + 2r Hence, choose S = {p1 , p2 , · · · , pi−1 , pi+1 , · · · , pn }, i.e. we have removed pi from M. Let
≡ 3 + 23z+2 P be the product of the elements of M. Then every factor of nS must be in M, and so we
≡ 3 + 4 · 8z must have
P
≡ 3 + 4 ≡ 0 (mod 7), − 1 = pai for some a
pi
c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 68 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 69
2. Modular Arithmetic Basics 2. Modular Arithmetic Basics

This is true because gcd(nS , pj ) = 1 for all j 6= i. Now this holds for all primes pi ∈ M. We 2.14 Practice Problems
act greedily and choose pi = 2. Then
Problem 2.14.1. How many prime numbers p are there such that 29p + 1 is a multiple of
P
− 1 = 2a p?
2
Note that 7|P since 7 ∈ M. Hence considering this equation modulo 7 yields Problem 2.14.2 (Useful Result). Let p be a prime and 0 ≤ k ≤ p − 1 be an intger. Prove
that  
2a ≡ −1 (mod 7) p−1
≡ (−1)k (mod p).
k
It is easy to see that this has no solutions and so we are done. Hints: 180

(We could also have done this mod 15 as 3, 5 ∈ M.)


Problem 2.14.3 (IMO 1979/1). Let a and b be natural numbers such that
Now we just need to show that given any prime q, there exists some good set of primes
A from M such that q|nA . The best we can do is to choose a set of equal primes from M, a 1 1 1 1 1
= 1 − + − + ··· − + .
but this is not possible since we can’t use repeated elements. But we can fix this idea. b 2 3 4 1318 1319
Note that M is infinite so mod q some residue occurs infinitely many times in M. Suppose Prove that a is divisible by 1979. (Note: 1979 is a prime) Hints: 350 407
that p1 ≡ p2 ≡ · · · modulo q. Then take A to be the first q − 1 elements from pi . Then
Problem 2.14.4 (RMO 2016 P62 ). Let {a1 , a2 , a3 , . . . , } be a strictly increasing sequence
nA ≡ pq−1
1 −1≡0 (mod q) of positive integers in an arithmetic progression. Prove that there is an infinite subsequence
of the given sequence whose terms are in a geometric progression. Hints: 288
and we are done!
Problem 2.14.5. Let f (x) be a polynomial with integer coefficients. Show that there does
not exist a N such that f (x) is a prime for all x ≥ N. In other words, f (x) is not eventually
always a prime. This problem shows that prime numbers don’t follow any polynomial pattern
either. Hints: 308

Problem 2.14.6 (IMO 2005/4). Determine all positive integers relatively prime to all the
terms of the infinite sequence
an = 2n + 3n + 6n − 1, n ≥ 1.
Hints: 130

Problem 2.14.7 (IMO 1986/1). Let d be any positive integer not equal to 2, 5, or 13.
Show that one can find distinct a and b in the set {2, 5, 13, d} such that ab − 1 is not a perfect
square. Hints: 379 84 9

Problem 2.14.8. Let a and b be two relatively prime positive integers, and consider the
arithmetic progression a, a + b, a + 2b, a + 3b, . . .
1. (G. Polya) Prove that there are infinitely many terms in the arithmetic progression
that have the same prime divisors. Hints: 265 156 349
2. Prove that there are infinitely many pairwise relatively prime terms in the arithmetic
progression. Hints: 487 37
2
Regional Mathematical Oolympiad (the AIME of India)

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 70 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 71
2. Modular Arithmetic Basics 2. Modular Arithmetic Basics

Problem 2.14.9. Prove that Problem 2.14.16 (IMO Shortlist 2015 N3). Let m and n be positive integers such that
m > n. Define
1. every positive integer has at least as many divisors of the for 4k + 1 as divisors of the m+k
form 4k + 3; xk =
n+k
2. there exist infinitely many positive integers which have as many divisors of the form for k = 1, 2, . . . , n + 1. Prove that if all the numbers x1 , x2 , . . . , xn+1 are integers, then
4k + 1 as divisors of the form 4k + 3; x1 x2 . . . xn+1 − 1 is divisible by an odd prime. Hints: 104 328 192 471 Sol: pg. 281

3. there exist infinitely many positive integers which have more divisors of the form 4k +1 Problem 2.14.17 (ELMO 2019/5). Let S be a nonempty set of positive integers such
than divisors of the form 4k + 3. that, for any (not necessarily distinct) integers a and b in S, the number ab + 1 is also in S.
Hints: 457 116 435 Show that the set of primes that do not divide any element of S is finite. Hints: 233 30 10 480
Sol: pg. 282
Problem 2.14.10 (IberoAmerican 2005/3). Let p > 3 be a prime. Prove that if
p−1
X 1 m
=
i=1
ip n

with gcd(m, n) = 1, then p3 | m. Hints: 357 207 284 231

Problem 2.14.11 (Sierpiński). Prove that for any positive integer s, there is a positive
integer n whose sum of digits is s and s | n. Hints: 200 397 197 Sol: pg. 280

Problem 2.14.12 (IMO Shortlist 2001 N4). Let p ≥ 5 be a prime number. Prove that
there exists an integer a with 1 ≤ a ≤ p − 2 such that neither ap−1 − 1 nor (a + 1)p−1 − 1 is
divisible by p2 . Hints: 204 218 467 66

Problem 2.14.13 (USAMO 2018/4). Let p be a prime, and let a1 , . . . , ap be integers.


Show that there exists an integer k such that the numbers
a1 + k, a2 + 2k, . . . , ap + pk
1
produce at least 2
p distinct remainders upon division by p. Hints: 194 241 115 Sol: pg. 281

Problem 2.14.14 (Balkan 2016/3). Find all monic polynomials f with integer coefficients
satisfying the following condition: there exists a positive integer N such that p divides
2(f (p)!) + 1 for every prime p > N for which f (p) is a positive integer. (A monic polynomial
has a leading coefficient equal to 1.) Hints: 341 321 67 436

Problem 2.14.15 (Iran 3rd round 2017 Numbers theory final exam P1). Let x and
y be integers and let p be a prime number. Suppose that there exist relatively prime positive
integers m and n such that
xm ≡ y n (mod p)
Prove that there exists an unique integer z modulo p such that
x ≡ zn (mod p) and y ≡ z m (mod p).
Hints: 20 365 108 Sol: pg. 281

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 72 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 73
2. Modular Arithmetic Basics 3. Arithmetic Functions

Lemma 2.14.1. Let p be an odd prime. Then We finish with a challenging problem related to the σ function!
   
k k Example 3.6.3 (St. Petersburg 2011)
≡ (mod p),
p p
Let m, n, k be positive integers with n > 1. Show that σ(n)k = nm is impossible.
where ⌊•⌋ represents the floor function (aka the greatest integer function).
The key thing to note here is that σ(n)k = nm implies σ(n), n have the same set of prime
This is not very tricky to prove, and very easy if you use Lucas’s theorem. So the proof
factors. Write n = pα1 1 . . . pαk k and σ(n) = pβ1 1 . . . pβkk .
is left as an exercise. Another useful property is
Now since σ(n) > n, hence k < m. Now, kβi = mαi for each i, so βi > αi implying
Lemma 2.14.2. Let   βi ≥ αi + 1. Hence,
k−1
1 (−1) p
≡ (mod p2 ).
k p k pα1 1 +1 − 1 pαk +1 − 1 p β1 − 1 p βk − 1
σ(n) = ··· k ≤ 1 ··· k < pβ1 1 · · · pβkk = σ(n),
p1 − 1 pk − 1 p1 − 1 pk − 1
The proof to this is pretty straightforward too:
  and we have a contradiction.
1 p (p − 1)(p − 2) . . . (p − k + 1)
=
p k k(k − 1) . . . 1
(−1)(−2) . . . (−k + 1) 3.7 Practice Problems

k(k − 1) . . . 1 √
1 Problem 3.7.1. Find all n ∈ N such that ⌊ n⌋ divides n. Hints: 122
= (−1)k−1 (mod p).
k
Problem 3.7.2. Let a, b, n be positive integers with gcd(a, n) = 1. Prove that
Here are two problems using the above lemma (note: they are challenging problems even
X  ak + b  n − 1
after using this lemma) = ,
k
n 2
Problem 2.14.20 (ELMO 2009/6). Let p be an odd prime and x be an integer such that
where k runs through a complete system of residues modulo n.
p | x3 − 1 but p ∤ x − 1. Prove that
 
x2 x3 xp−1 Problem 3.7.3. Let f (x) be defined for all rationals x ∈ [0, 1]. If
p | (p − 1)! x − + − ··· − .
2 3 p−1 n   n  
X k X k
F (n) = f , G(n) = f ,
Problem 2.14.21 (IMO Shortlist 2011 N7). Let p be an odd prime number. For every k=1
n n
k=1,(k,n)=1
integer a, define the number
then prove that G = ζ ∗ F, where ζ(n) is the sum of the primitive nth roots of unity. Hints:
a a2 ap−1 127 410 225
Sa = + + ··· + .
1 2 p−1
Problem 3.7.4. Show that for all positive integers n,
Let m, n ∈ Z, such that √ √ √ √ √
m ⌊ n + n + 1⌋ = ⌊ 4n + 1⌋ = ⌊ 4n + 2⌋ = ⌊ 4n + 3⌋.
S3 + S4 − 3S2 = .
n
Prove that p divides m. Hints: 95 21

Problem 3.7.5. Prove that for any n ∈ N,


σ(n) √
≥ n.
d(n)
Hints: 58 250

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 76 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 101
3. Arithmetic Functions 3. Arithmetic Functions

Problem 3.7.6 (IMO 1968/6). Prove that for any positive integer n, Problem 3.7.14 (IMO 1998/3). Determine all positive integers k such that
       
n+1 n+2 n+4 n+8 d(n2 )
+ + + + · · · = n. =k
2 4 8 16 d(n)

Hints: 198 39 351 for some n ∈ N. Hints: 486 339 275 173

Problem 3.7.7 (INMO 2014). Let n be a natural number. Prove that Problem 3.7.15 (IMO Shortlist 2004 N2). The function f from the set N of positive
integers into itself is defined by the equality
jnk jnk jnk √
+ + ··· + + ⌊ n⌋ n
1 2 n X
f (n) = gcd(k, n), n ∈ N.
is even. Hints: 409 k=1

1. Prove that f (mn) = f (m)f (n) for every two relatively prime m, n ∈ N.
Problem 3.7.8. Prove that for any integer n ≥ 1,
 2 2. Prove that for each a ∈ N the equation f (x) = ax has a solution.
X 3
X
(d(m)) =  d(m) 3. Find all a ∈ N such that the equation f (x) = ax has a unique solution.
m|n m|n
Hints: 113 382 268 293 44 114
Hints: 463 414
Problem 3.7.16 (IMO Shortlist 2011 N1). For any integer d > 0, let f (d) be the smallest
Problem 3.7.9 (Belarus 1999). For n ≥ 2, possible integer that has exactly d positive divisors (so for example we have
 f (1) = 1, f (5) =
p 16, and f (6) = 12). Prove that for every integer k ≥ 0 the number f 2k divides f 2k+1 .
σ(n) < n 2d(n). Hints: 224 449 140 Sol: pg. 283

Hints: 381 11 Problem 3.7.17 (ELMO 2017/4). An integer n > 2 is called tasty if for every ordered
pair of positive integers (a, b) with a+b = n, at least one of ab and ab is a terminating decimal.
Problem 3.7.10 (1998 Irish Mathematical Olympiad). Find all positive integers d Do there exist infinitely many tasty integers? Hints: 297 133 57 324 Sol: pg. 284
that have exactly 16 positive integral divisors d1 , d2 , . . . , d16 such that 1 = d1 < d2 < · · · <
d16 = d, d6 = 18 and d9 − d8 = 17. Hints: 25 155 213 Problem 3.7.18 (USA TSTST 2016/4). Suppose that n and k are positive integers such
that
Problem 3.7.11 (IMO 1991/2). Let n > 6 be an integer and a1 , a2 , · · · , ak be all the 1 = ϕ(ϕ(. . . ϕ( n) . . . )).
natural numbers less than n and relatively prime to n. If | {z }
k times

a2 − a1 = a3 − a2 = · · · = ak − ak−1 > 0, Prove that n ≤ 3k . Hints: 455 203 89 1 289

prove that n must be either a prime number or a power of 2. Hints: 437 191 101 Problem 3.7.19 (IMO Shortlist 2016 N2). Let d(n) be the number of positive divisors
of n. Let d1 (n) be the number of positive divisors of n which have remainders 1 when divided
Problem 3.7.12 (IMO Shortlist 2016 C2). Find all positive integers n for which all by 3. Find all positive integral values of the fraction dd(10n)
1 (10n)
. Hints: 386 362 236 220 Sol: pg.
positive divisors of n can be put into the cells of a rectangular table under the following 284
constraints: each cell contains a distinct divisor; the sums of all rows are equal; and the
sums of all columns are equal. Hints: 259 47 427 Sol: pg. 282 Problem 3.7.20 (China Mathematical Olympiad 2017/5). Let Dn be the set of di-
visors of n. Find all natural n such that it is possible to split Dn into two disjoint sets A
Problem 3.7.13 (St. Petersburg City Mathematical Olympiad 1998). Prove that and G, both containing at least three elements each, such that the elements in A form an
the sequence d(n2 + 1) does not become monotonic from any given point onwards. Hints: 80 arithmetic progression while the elements in G form a geometric progression. Hints: 149 24
286 Sol: pg. 283 314 111 Sol: pg. 285

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 102 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 103
3. Arithmetic Functions 4. Diophantine Equations

Problem 3.7.21 (China 2015 TST 3/6). For all natural numbers n, define f (n) = Problems for Practice
d(n!) − d((n − 1)!). Prove that there exist infinitely many composite n, such that for all
naturals m < n, we have f (m) < f (n). Hints: 448 273 109 291 Sol: pg. 286 Problem 4.6.1. We solved Example 4.6.1 by showing if (x, y, z) works, then so does (x/2, y, z).
The power of 2 in x/2 is less than the power of 2 in x. Use this argument to find a second
solution to the problem. (take the example of (16, 4, 12) to get an idea)

4.7 Vieta Jumping


Vieta Jumping is a technique

Example 4.7.1 (IMO 1988/6)

Let a and b be positive integers such that ab + 1 divides a2 + b2 . Show that

a2 + b2
ab + 1
is the square of an integer.

a2 +b2
This is a fascinating result; it says that if k = ab+1
is an integer, then it is not just any
integer, rather a square number!
We could experiment here, maybe try and find explicit values for which ab + 1 | a2 + b2 .
However, we don’t find anything very interesting by these direct methods. Now we try our
strongest weapon, the method of contradiction.
Suppose
a2 + b 2
k= ∈Z
ab + 1
is not a square number. Rearranging, we get an obvious quadratic in a

a2 − kb · a + (b2 − k) = 0.

The interesting part now is if we define f (t) = t2 − kbt + (b2 − k), then f has two roots, one
of which is a. Are the roots equal?

Question 4.7.1. Keeping in mind that a, b are positive integers, show that k is a positive
integer. Hence, show that the above quadratic cannot have equal roots.

So, if we let the other root be x 6= a, then

x 2 + b2
= k.
xb + 1
b2 −k
What do we know about x? By Vieta, we know that x = kb − a and x = a
.

Question 4.7.2. Show that x is an integer.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 104 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 116
4. Diophantine Equations 4. Diophantine Equations

Hence, we went from the pair (a, b) to the pair (x, b). If we can show that (x, b) is ”smaller” As an explicit example, if we start with (a, b) = (30, 8), then we go
than (a, b), then we have something like an infinite descent. This is the key idea. We only
need to take care of some details now. ˙
(112, 30) → (30, 8) → (2, 8) → (2, 0).
We saw that x is an integer. We now show that x is a positive integer.

Question 4.7.3. Use the equation k = (x2 + b2 )/(xb + 1) and the fact that k > 0 to show Comment 4.7.1 (Geometric Interpretation): Suppose k = (x2 + y 2 )/(xy + 1).
that x ≥ 0. This is the same as x2 + y 2 − kxy − k = 0, which forms a hyperbola H. Assume x > y,
since if x = y then we can get that k must equal 1a (why?). Then, if we have a lattice
How do we eliminate the possibility that x = 0? Well, x = (b2 − k)/a, hence if x = 0, point (x, y) ∈ H, then by Vieta the point (qy − x, y) is also a lattice point on H.
then k = b2 is a perfect square, which contradicts our assumption! Further, we can show that qy − x < x and so the x coordinate is lower. Repeating
So, from a positive pair (a, b), we went to a positive pair (x, b) (here a positive pair means this we get closer and closer the the origin, eventually ending at a point of the form
both elements are positive integers). In order for the new pair to be smaller, we would like (x0 , 0) or (0, y0 ), wherein we get k = x20 or y02 respectively.
x < a. This is equivalent to a
In that case we get an ellipse.
b2 − k
< a ⇔ b 2 − k < a2 .
a
There is no clear reason why this must be true. In fact, this might not even be true!

Question 4.7.4. Suppose (a, b) = (8, 30). Show that this ab + 1 | a2 + b2 here. Now, show
that the process above gives
(8, 30) → (112, 30).
Hence, we got a bigger pair in this case. Show that, however, if (a, b) = (30, 8), then we get
(8, 30)
(30, 8) → (2, 8) (112, 30)

which is indeed smaller.

Thus, we need the important assumption at the start: without loss of generality, a > b
(0, 2)
(note that if a = b, then it is easy to get k = 1, which is a square. So suppose a 6= b). In
fact, then b2 − k < a2 becomes obvious. Hence x < a. So, from (a, b) we went to (x, b) with (8, 2)
x + b < a + b.
So, do we have a descent? If we repeat the process of (x, b), we would get a quadratic in
x, and we pick the second root. Do you see an issue?

Question 4.7.5. Revisiting our example, once we get (30, 8) → (2, 8), what do we get after
(2, 8)? Figure 4.1: Example with k = 4

The other root is a, the number we started with! So, if we want a new quadratic, we If we retrospect, we realize that we can shorten some of our work. For instance, since
work with (b, x) now instead of (x, b). This would give a quadratic in b and we get a new we show x < a, hence we don’t need to show that the quadratic does not have equal roots.
pair. However, if we want a smaller pair, we would need b ≥ x. Is that true? Realizing this Further, there was no need of showing x < b, here’s why: We have the pair (a, b) with
is harder than proving it: a > b. Then we go to (x, b) with x < a. If at this point, we have x > b, then we repeat
b2 b2 − k everything we just did and get to (a, b) from (x, b), since a is the other roots of the quadratic
b≥ > = x.
a a x forms. However, since everything in the proof would be identical, we can similarly prove
Thus, we have a descent. Hence, we go from positive pairs to smaller positive pairs, however (a, b) is smaller than (x, b) meaning a < x, which contradicts the fact that x < a. So here’s
this process can’t go on forever, and so we are done! a summary of what we did:

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 117 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 118
4. Diophantine Equations 4. Diophantine Equations

1. We assumed on the contrary the result is not true, i.e. k = (a2 + b2 )/(ab + 1) ∈ Z but One root is a, so say the other one is x. Then by Vieta, x = kb − a which means x is an
2
is not a square. integer. Also by Vieta, x = b a+1 > 0, which shows that x is a positive integer. Now, if we
want (x, b) to be smaller than (a, b), then we want x < a. Since a > b, hence
2. First we showed that if the quadratic in t
b2 + 1
2 2
x= <a
k = (t + b )/(tb + 1) a
holds unless (a, b) = (2, 1) (why?). If (a, b) = (2, 1), then k = 6/2 = 3, as desired. So
has one positive integer root a, then the second root of the quadratic is also a positive suppose not. Hence (x, b) is a smaller pair, i.e. x < a. Now, the new x is less than b since
number x. (this part does not require vieta jumping).
b2 + 1 b2 + 1 1
3. At this point, we assumed without loss of generality that a ≥ b. x= < =b+
a b b
4. We then showed x is also an integer. Hence x is a positive integer. So we can have a and if b > 1, this means x ≤ ⌊b + 1/b⌋ = b (why?). In that case, we obtained a smaller pair
valid descent. and can now proceed descent on (b, x) as b ≥ x. Note again that if b = x, then k = 3. So we
may assume b > x.
5. Finally, we showed x < a. Hence (a, b) gives a smaller pair (x, b). Thus we have a Hence, the descent must end either when one number becomes 1. In that case if the other
descent. number is z, then we have z | z 2 + 2 which can only happen if z ∈ {1, 2}. In either case, we
obtain k = 3 so we are done.
The best way to tackle all the details is to write down an explicit example. So here’s an
exercise for you: repeat the process on (3120, 125). Now that we have a grip on the basic technique, we can try our hands on some more
challenging problems.

Comment 4.7.2: A neater way of phrasing the above is to use the extremal principle. Example 4.7.3 (IMO 2007/5)
Fix k first, and pick non-negative integers (a, b) such that
Let a and b be positive integers. Show that if 4ab − 1 divides (4a2 − 1)2 , then a = b.
a2 + b 2
=k
ab + 1 First, we start by simplifying (4a2 −1)2 as much as possible by subtracting suitable terms.
Since gcd(b, 4ab − 1) = 1, hence
with a + b minimum. For instance, for k = 4, both (2, 0) and (30, 8) are valid pairs.
So out of all these we pick the one with a + b minimum. Then, once we show x ≤ a is a 4ab − 1 | (4a2 − 1)2 ⇔ 4ab − 1 | b2 (4a2 − 1)2 .
positive integer, so that (x, b) is also a valid pair, we say that x+b < a+b contradicting
the minimality. From here on, we will use wither descent or the extremal principle to Now,
phrase our argument, depending on which one is easier. b2 (4a2 − 1)2 = 16a4 b2 − 8a2 b2 + b2
≡ a2 − 2ab + b2
Example 4.7.2 = (a − b)2 (mod 4ab − 1).
We stop here, since (a − b)2 is symmetric in a, b and much simpler. The best part is that if
Let a and b be positive integers such that ab divides a2 + b2 + 1. Show that
we want a = b, we want to prove (a − b)2 = 0. So let
a2 + b 2 + 1 (a − b)2
= 3. k= ∈ Z.
ab 4ab − 1
The idea is similar here, except that we don’t proceed by contradiction. Define k to be We can now use Vieta Jumping! Suppose that (a, b) satisfies a + b is minimum.
the ratio (a2 + b2 + 1) : ab, so that we want to show k ∈ N =⇒ k = 3. Assume a > b (if a = b we are done already) and define the quadratic f (t) = t2 − 2b(1 +
Firstly note that a = b implies k = 3 directly. Suppose without loss of generality a > b 2k)t + b2 + k. One root is a, let the other be x. So, we go
 2 
now. Define the quadratic b +k
f (t) = t2 − kbt + b2 + 1. (a, b) → ,b .
a

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 119 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 120
4. Diophantine Equations 4. Diophantine Equations

Clearly, x is a positive integer (why?). Now, we can use descent if x < a. This follows since observe that w = (y 2 + z 2 )/x. Hence, w is a positive integer. Now, we want to establish a
descent. Proving w < x is not easy (try it). The key trick is to compute f (y) :
b2 + k b2 k
= +
a a a f (y) = y 2 − ky 2 z + y 2 + z 2 ≤ 3y 2 − ky 2 z = y 2 (3 − kz)
b2 (a − b)2
= +
a a(4ab − 1) For now, say k 6= 2, so that k > 3. Hence we get f (y) ≤ 0.. Hence, y lies between the two
4ab3 − b2 + a2 − 2ab + b2 roots x, w (why?) and since x > y, hence y > w implying x > w. So, x + y + z has reduced,
= . and we have our contradiction.
a(4ab − 1)
So now we just have to deal with the case k = 2. This is Problem 4.7.1.
We want this to be less than a. That is equivalent to

4ab3 + a2 − 2ab < 4a3 b − a2 ⇔ 2a(a − b)(2b(b + a) − 1) > 0. Problems for Practice
This is true since assumed a > b. So, we have 0 < x < a is a positive integer, and (x, b) is a Problem 4.7.1 (Korean Mathematical Olympiad). Prove that x2 + y 2 + z 2 = 2xyz has
valid pair. Then x + b < a + b contradicting minimality. So we are done. no solutions in integers x, y, z except (0, 0, 0).

Example 4.7.4 Problem 4.7.2 (Stronger than IMO 1988/6). Show that if ab + 1 divides a2 + b2 for
Let k be a positive integers not equal to 1 or 3. Prove that the only solution to positive integers a, b, then
a2 + b2
= gcd(a, b)2 .
x2 + y 2 + z 2 = kxyz ab + 1

over integers is (0, 0, 0). Problem 4.7.3 (Generalization of IMO 1988/6). If a, b, c are positive integers such
that
Vieta jumping can’t work here directly, the reason being the fact that x, y, z can be 0 < a2 + b2 − abc ≤ c,
negative. So there is in fact no minimum value of x + y + z. So let’s try to see if we can show that a2 + b2 − abc is a perfect square.
make terms positive somehow.
Question 4.7.6. Show that if one of x, y, z is 0, then so are the rest. Henceforth assume Problem 4.7.4. Let x1 , x2 , . . . , xn be n integers. If k > n is an integer, prove that the only
xyz 6= 0. solution to
x21 + x22 + · · · + x2n = kx1 x2 . . . xn
Now observe that either all x, y, z are all positive, or two of them are negative (why?).
Suppose y, z are negative. Note that if we replace y 7→ −y, z 7→ −z, the equation still holds. is x1 = x= · · · = xn = 0.
Hence, we can assume without loss of generality that x, y, z are all positive. Now we can use
Vieta Jumping.
4.8 Pell’s Equations
For a given k, pick (x, y, z) ∈ N3 1 . such that x + y + z is minimum. The key claim now
is that all x, y, z are distinct. Definition 4.8.1. The equation x2 − dy 2 = 1 where d is a positive integer which is not a
2 2
To see this, observe that if y = z, the equation becomes x + 2y = kxy . Hence, y | x. 2 square is called Pell’s Equation.
Write x = yℓ. Then ℓ2 − kyℓ + 2 = 0. Since ℓ ∈ Z, we must have k 2 − 8 = u2 for some u. So
Here, we need d to not be a square, otherwise if d = c2 , then this becomes (x−cy)(x+cy) =
(k − u)(k + u) = 8, and we get k = 3 as the only possibility, which we have excluded from
1. We have the following beautiful theorem:
the problem.
So now assume without loss of generality x > y > z. Define f (t) = t2 − kyzt + y 2 + z 2 . Theorem 4.8.1. The Pell’s equation always has a solution (x, y).
One root is x, so say the other root is w. Then w = kyz − x implies w ∈ Z. To show w > 0,
In fact, there are infinitely many solutions to the equation! Given that there is 1 solution,
1
we write (a, b) ∈ N2 or N × N if a ∈ N and b ∈ N. In other words, N2 is the set of all pairs (a, b) where we can generate more from it. Let’s see how.
both the elements are from N. Similarly we define N3 , N4 , . . . (we can even define R2 , Z3 , C4 . . . similarly).
So, in our case we mean x, y, z are all natural numbers. Firstly, we need to define something:

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 121 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 122
4. Diophantine Equations 4. Diophantine Equations


Definition 4.8.2. Define
√ a number z = x + y d. Then, the conjugate of z, denoted by z, Theorem√4.8.3. Let d be a positive integer which is not a perfect square. Then there exists
is given by z = x − y d. Further, the Norm of z is given by ε = x0 +y0 d with x0 , y0 ∈ N such that every solution (x, y) to the Pell’s equation x2 −dy 2 = 1
is found by √ √
N(z) = zz = x2 − dy 2 . x + y d = εn = (x0 + y0 d)n
Note the resemblance with complex numbers. In fact, in algebraic number theory we for some integer n.
study general conjugates and norms, which apply to all these numbers! However, let’s not Note that x0 , y0 are both positive. The proof is not very hard. They idea is that the
divert now. fundamental solution (x0 , y0 ) is the ”smallest”.
One of the most useful property of the Norm is the following: √
Proof. Consider α to be the√ smallest real of the form x + y d which is greater than 1 and
Theorem 4.8.2. The Norm is multiplicative, i.e. has norm 1. Let β = a + b d be such that (a, b) is another solution to X 2 − dY 2 = 1. Let k
be such that
N(z1 z2 ) = N(z1 ) N(z2 ). αk ≤ β < αk+1 .

(This also holds for complex numbers). The proof of this isn’t very hard, just expand (since α < β and αn → ∞ as n → ∞ (as √ α > 1) hence√by continuity there must exist such
and check: a k). Now since N(α) = 1, hence (x + y d)−1 = x − y d. So
β √ √
N(z1 ) N(z2 ) = (a2 − db2 )(x2 − dy 2 ) = (ax + dby)2 − d(ay + bx)2 = N(z1 z2 ). γ= = (a + b d)(x − y d)k .
αk

In fact, the conjugate is also multiplicative. Now, N(γ) = 1, and on expanding γ comes to be something of the form√r + s d. Note
√ √
2 2
Now, we can see how this is useful: Saying x −dy = 1 is the same as saying z = x+y d that 1 ≤ γ means γ ≤ 1 (as N(γ) = 1). Hence r − s d ≤ 1 ≤ r + s d, showing r, s
satisfies N(z) = 1. Now, note that are nonnegative. Since γ < α, the minimality of α is contradicted unless γ = 1, which
corresponds to β = αk , as desired.
N(z 2 ) = N(z) · N(z) = 1.

Hence, if z satisfies N(z) = 1, then so does z 2 . In fact, N(z k ) = 1 for any natural number k. Example 4.8.2 (Kürsák Competition)
So from one solution, we can generate infinitely many. √
Prove that if m = 2 + 2 28n2 + 1 is an integer for some n ∈ N, then m is a perfect
Example 4.8.1 square.

Suppose d = 3. Then (x, y) = (2, 1) is a solution. So z = 2 + 3 works. Now, For m to be an integer, we must have 28n2 + 1 = x2 for some x. This is Pell’s equation
√ √ with d = 28. If we try to find the fundamental solution, we have a really hard time doing so.
z 2 = (2 + 3)2 = 7 + 4 3. Hence we adopt a trick: write the equation as x2 − 7(2n)2 = 1.

Hence, we get another solution (x, y) = (7, 4). Further, The fundamental solution to X 2 − 7Y 2 = 1 is not hard to find, and it is (8, 3). Here, 3 is
odd. We generate more solutions from this till we find the second number even (why do we
√ √
z 3 = (2 + 3)3 = 26 + 15 3. need this?).
 √ 2 √
8 + 3 7 = 127 + 48 7.
This gives the solution (x, y) = (26, 15). We can keep proceeding and generate infinitely
many solutions. So the second solution is (127, 48). Thus (127, 24) is the fundamental solution to x2 −28n2 = 1
(couldn’t have guessed this, could we?). Hence,
Whenever we start with a z, we can generate infinitely many solutions, however we can √ √
x + y 28 = (127 + 24 28)k
guarantee that these would be all the solutions√to the Pell’s equation. For instance in the
√ √
above example, if we√had started with z = 7 + 4 3, then no power of z would have given us for some k. To find x from above, we use another trick: let z = x+y 28 and z0 = 127+24 28.
the solution 26 + 15 3. So how do we find all the solutions to the Pell’s equation? 1
Observe that x = 2 (z + z) and hence
Turns out that there exists one solution z called the fundamental solution which 1 √ √ 
generates all the solution to the Pell’s equation. x= (127 + 24 28)k + (127 − 24 28)k
2
c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 123 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 124
4. Diophantine Equations 4. Diophantine Equations

√  √ k
since (127 + 24 28)k = 127 + 24 28 as conjugation is multiplicative. Now, Example 4.8.3 (Vietnam 2016)

√ √  √ √ 2 Find all n such that r


2 + 2x = (127 + 24 28)k + (127 − 24 28)k + 1 = (8 + 3 7)k + (8 − 3 7)k 7n + 1
2
and we are done. is a prime.
Question 4.8.1. Why is the part inside the square an integer? That is, why is
√ √ Suppose this equals p. Squaring and rearranging, we find 7n −2p2 = −1. This is not Pell’s
(8 + 3 7)k + (8 − 3 7)k equation if n is odd. We can easily see that n = 1 works. So when n > 1 small cases suggest
that n odd doesn’t seem to work. This observation is correct; modulo 8, the equation implies
an integer? n is even. So we have the negative Pell’s equation:
The trick we used before can be generalized to give all solutions of the Pell’s equation: (7m )2 − 2p2 = −1
Theorem 4.8.4 (General Solution of Pell’s Equation). Let x2 − dy 2 = 1 be a Pell’s equation
where m = n/2. So consider the general Pell’s equation
√ x2 − 2y 2 = −1. Since (1, 1) is a
with fundamental solution (x0 , y0 ). Let (xn−1 , yn−1 ) be the nth solution. Then
solution, hence the solutions are generated by (1 + 2)2k+1 for all k ≥ 0. Hence, the general
1 √ √  1  √ √  solution for xn is
xn−1 = (x0 + y0 d)n + (x0 − y0 d)n , yn−1 = √ (x0 + y0 d)n − (x0 − y0 d)n .
2 2 d
1 √ √  1 + √2  √ k 1 − 2 

√ k
 √ √  xn−1 = (1 + 2)2k+1 + (1 − 2)2k+1 = 3+2 2 + 3−2 2 .
1
For instance, x0 = 2 (x0 + y0 d) + (x0 − y0 d) = x0 and x1 = x20 + dy02 . 2 2 2

You might recognize the above formulas as the solutions of a linear recurrence equation. So we obtain the recurrence xn = 6xn−1 − xn−2 with (x0 , x1 ) = (1, 7). Similarly we get
This is indeed true, and we can find these recurrences: yn = 6yn−1 − yn−2 with (y0 , y1 ) = (1, 5). Then

Theorem 4.8.5 (Recursive Solutions of Pell’s Equations). Let x2 − dy 2 = 1 be a Pell’s xn ≡ −(xn−1 + xn−2 ) (mod 7), yn ≡ yn−1 − yn−2 (mod 5).
equation with fundamental solution (x0 , y0 ). Let (xn−1 , yn−1 ) be the nth solution. Then
Hence, 7 | xn if and only if n ≡ 1 (mod 3), which also corresponds to 5 | yn . Hence, we must
xn = 2x0 xn−1 − xn−2 , yn = 2x0 yn−1 − yn−2 . have p = 5 and so the only other solution we get is n = 2.

This is true because xn = Aαn + Bβ n satisfies xn = (α + β)xn−1 − (αβ)xn−2 . Problems for Practice
There are some variants of the Pell’s equation, the most common being the negative
Problem 4.8.1. Show that zw = zw, i.e conjugation is multiplicative.
Pell’s equation:

Definition 4.8.3. Let d be a positive integer that is not a perfect square. Then the equation Problem 4.8.2. Prove Theorem 4.8.4.
x2 − dy 2 = −1 is a negative Pell’s equation.
Problem 4.8.3. Using the binomial theorem, show that xn , yn are integers in Theorem 4.8.4.
Unlike the standard one, this equation need not have solutions at all. However, if there
exists one solution, then there exist infinitely many. This is done by taking a fundamental
solution z0 , and considering the solutions z0k where k is odd, and these form all the solutions
(as before). In fact, z02 gives the fundamental solution to x2 − dy 2 = 1.
If we consider equations of the form x2 − ny 2 = r for |r| =
6 1, then we can just consider
powers of a fundamental solution. Here, we take one solution and multiply it by solutions
of x2 − ny 2 = 1. However, in this case this does not generate all the solutions, unlike before.
Luckily, these don’t show up a lot in Olympiads.
Here’s a great example:

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 125 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 126
4. Diophantine Equations 4. Diophantine Equations

4.9 Practice Problems Problem 4.9.9 (EGMO 2013/4). Find all positive integers a and b for which there are
three consecutive integers at which the polynomial
Problem 4.9.1. Solve in positive integers the equation
n5 + a
2 2 2
P (n) =
x y + yz + zx = 3xyz. b
takes integer values. Hints: 6 216 126 Sol: pg. 286
Hints: 128

Problem 4.9.2. Find all triples of positive integers (x, y, z) such that Problem 4.9.10 (Leo Moser). Show that the Diophantine equation

1 1 1 1
x3 + y 3 + z 3 − 3xyz = p, + + ··· + + =1
x1 x2 xn x1 x2 · · · xn
Hints: 52
has at least one solution for every positive integers n. Hints: 430
Problem 4.9.3 (USAMTS 2017-18 Round 3 P2). Let q be a real number. Suppose Problem 4.9.11 (IMO 2013 Problem 1). Assume that k and n are two positive integers.
there are three distinct positive integers a, b, c such that q + a, q + b, q + c is a geometric Prove that there exist positive integers m1 , . . . , mk such that
progression. Show that q is rational. Hints: 7
   
2k − 1 1 1
Problem 4.9.4 (IMO 2006/4). Determine all pairs (x, y) of integers such that 1+ = 1+ ··· 1 + .
n m1 mk
1 + 2x + 22x+1 = y 2 . Hints: 402 195

Hints: 206 411 358 Problem 4.9.12. Show that the equation

Problem 4.9.5 (INMO 2017/6). Let n ≥ 1 be an integer and consider the sum a2 + b2 + c2 + d2 = abcd
X n   
n n
 
n n−2
 
n n−k 2
x= 2n−2k 3k = 2 + 2 ·3+ 2 · 3 + ···. has infinitely many solutions in positive integers a, b, c, d. Hints: 287 129 484 Sol: pg. 287
k≥0
2k 0 2 4
Problem 4.9.13 (USAMO 2015/1). Solve in integers the equation
Show that 2x − 1, 2x, 2x + 1 form the sides of a triangle whose area and inradius are also
 3
integers. Hints: 302 440 x+y
x2 + xy + y 2 = +1 .
3
Problem 4.9.6 (Indian Mathematical Olympiad 1988). Find all (x, y, n) ∈ N3 such
that gcd(x, n + 1) = 1 and xn + 1 = y n+1 . Hints: 81 46 270 199 Hints: 38 369 346 445

Problem 4.9.7 (USAMO 1987). Solve the following equation in nonzero integers x, y : Problem 4.9.14 (IMO Shortlist 2012 N2). Find all triples (x, y, z) of positive integers
such that x ≤ y ≤ z and
(x2 + y)(x + y 2 ) = (x − y)3 . x3 (y 3 + z 3 ) = 2012(xyz + 2).

Hints: 391 215 Hints: 363 93 3 124

Problem 4.9.8. Find all positive integers m and n for which Problem 4.9.15 (Vietnam 2002). Find all positive integers n for which the equation

1! + 2! + 3! + · · · + n! = m2 . a + b + c + d = n abcd

Hints: 229 380 has a solution in positive integers a, b, c and d. Hints: 19 453

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 127 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 128
4. Diophantine Equations 5. Modular Arithmetic Advanced

Problem 4.9.16 (HMMT 2017 A8). Suppose a and b are positive integers such that This problem was very easy to do using primitive roots, however challenging to do oth-
erwise. Further, this is a very very important result. Always keep this in mind when dealing
(a + b)(a + b + 1) with sums of powers. Also, this is an important result so remember this.
c=
ab
is an integer. Find all possible values of c. Hints: 296 167 32
Problems for Practice
Problem 4.9.17 (IMO 2008 N1). Let n be a positive integer and let p be a prime number. Problem 5.5.1. Let g be a primitive root modulo an odd prime p. If p = 2m + 1, then show
Prove that if a, b, c are integers (not necessarily positive) satisfying the equations that
g m ≡ −1 (mod p).
an + pb = bn + pc = cn + pa

then a = b = c. Hints: 14 131 385 99 Sol: pg. 287 Problem 5.5.2. Prove that if r is a primitive root modulo m, then so is the inverse of r
modulo m.
Problem 4.9.18 (IMO Shortlist 2017 N6). Find the smallest positive integer n or show
no such n exists, with the following property: there are infinitely many distinct n-tuples of Problem 5.5.3. Show that there are exactly ϕ(p − 1) primitive roots modulo p.
positive rational numbers (a1 , a2 , . . . , an ) such that both
Problem 5.5.4. Show that for any prime p, the quadratic residues mod p are exactly the
1 1 1 numbers g 0 , g 2 , g 4 , . . . for a primitive roots g mod p.
a1 + a2 + · · · + an and + + ··· +
a1 a2 an
are integers. Hints: 210 332 61 374 Sol: pg. 288 5.6 Some more applications
Problem 4.9.19 (IMO Shortlist 2019 N8). Let a and b be two positive integers. Prove Now let’s see the power of this in proving the other direction of Theorem 5.3.1:
that the integer  2
4a Proof. We want an x such that x2 ≡ −1 (mod p), if p ≡ 1 (mod 4) is a prime. Instead of
a2 +
b finding x, we look for a y such that (g y )2 ≡ −1 (mod p).
is not a square. Hints: 29 404 251 182 Sol: pg. 289 We can now guess a value of y; simply take y = p−1
, since then g 2y = g (p−1)/2 ≡ −1
4
(mod p) by Problem 5.5.1, and we are home free!
Problem 4.9.20 (China TST 3 2018 Day 3/2). Find all pairs of positive integers (x, y)
such that (xy + 1)(xy + x + 2) be a perfect square. Hints: 279 69 429 2 Sol: pg. 290 Question 5.6.1. Where was the fact that 4 | p − 1 used?

Primitive roots are thus very useful in construction type problems too. Also, here’s a
lemma that you should keep an eye out since it helps to use Fermat’s Christmas Theorem:

Lemma 5.6.1. Let x ≡ 3 (mod 4). Then x has at least one prime divisor p ≡ 3 (mod 4)
which has an odd exponent.

Proof. Assume not. Then


x = pα1 1 . . . pαk ≡ 1 (mod 4)
u even
since 1 ≡ 1 and 3 ≡ 1 (mod 4).

Example 5.6.1

Prove Wilson’s Theorem.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 129 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 140
5. Modular Arithmetic Advanced 5. Modular Arithmetic Advanced

Firstly, the case p = 2 is obvious. Now assume p is odd. Clearly we can use Lemma 5.5.1 Theorem 5.7.1. A primitive root modulo m exists if and only if m ∈ {2, 4, pk , 2pk } for some
to get: integer k and some prime p.

(p − 1)! = (p − 1) · (p − 2) . . . 1 This means that if, for instance m = 57 , then there does exist a primitive root modulo
≡ g 1 · g 2 . . . g p−1 m. If m = 2 · 3 · 5, then there won’t exist a primitive root modulo m. We again, omit the
proof of this theorem.
= g p(p−1)/2
The other properties are analogous. For instance, {g 1 , g 2 , . . . , g ϕ(m) } is the set of residues
= (g p−1/2 )p that are coprime to m (this is the same set S we had in Theorem 2.9.1.)
≡ (−1)p = −1 (mod p).
Here’s a simple problem:
Where g (p−1)/2 ≡ −1 follows by Problem 5.5.1.
Example 5.7.2

Problems for Practice Suppose that m does not have a primitive root. Show that

Problem 5.6.1 (Generating numbers with orders). Let p be a prime and d be any a
ϕ(m)
2 ≡1 (mod m)
divisor of p − 1. Show that there exists an integer a such that ordp (a) = d.
for every a relatively prime to m.

5.7 General Orders and Primitive Roots The condition is weird, however, looking at the φ(m) we are obviously reminded of Euler’s
Totient Function. We have aϕ(m) ≡ 1 (mod m). Hence, if aϕ(m)/2 = x (mod m), then x2 ≡ 1
We have defined orders modulo a prime. However, they can easily be generalised to orders
(mod m), i.e.
modulo any number.  φ(m)   φ(m) 
m | a 2 − 1 a 2 + 1 = (x + 1)(x − 1).
Definition 5.7.1. Let a, m be coprime integers. Then the order of a modulo m is the smallest
integer x > 0 such that ax ≡ 1 (mod m). At this point, we can now make more sense of the weird condition in the problem. Clearly
if p were a prime, then the above would imply m | (x − 1) or m | (x + 1), the former being
The theorem that aN ≡ 1 (mod m) implies ordm (a) | N also holds here, and the proof the one we would want.
is analogous. In particular, we find that ordm (a) | ϕ(m). Now if m = xy with x, y coprime and x, y > 2, then
Time for a very famous example ϕ(m) ϕ(y)
a 2 = aϕ(x)· 2 ≡1 (mod x).
Example 5.7.1 (Saint Petersburg Mathematical Olympiad) ϕ(m)
Similarly it is ≡ 1 (mod y). Combining, we get a 2 ≡ 1 (mod xy). The case m = 2k with
Prove that for all positive integers a > 1 and n we have n | ϕ(an − 1) k > 2 is left to reader.

The ϕ function is not easy to deal with, especially ϕ(an − 1). However, since we want
Problems for Practice
n | ϕ(an − 1), we could try to find a number which has order n modulo an − 1. The most
logical guess is a. So if we can show ordan −1 (a) = n, we are done. Problem 5.7.1. Complete the proof above.
However, this is not too hard. It is easy to see that the smallest integer d > 0 such that
Problem 5.7.2. Show that there are ϕ(ϕ(n)) primitive roots.
ad ≡ 1 (mod an − 1) is n (why?), and so we are done! What an amazing application of
orders.
Similarly, we can define primitive roots in general:

Definition 5.7.2. A residue g is called a primitive root modulo m is the order of g


modulo m is ϕ(m).

However, there is some restriction:

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 141 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 142
5. Modular Arithmetic Advanced 5. Modular Arithmetic Advanced

5.8 Example Problems If r = 3, then q | 32 + 1 = 10 and so q = 5 (since we obtained q is odd). If 2q |


r + 1, then we try to combine it with q | r2 + 1. We get q | r + 1, r2 + 1 which implies
Our first example is a long one, although there aren’t a lot of clever steps involved. It’s q | r2 + 1 − (r + 1)(r − 1) = 2, which is again impossible since q was odd. So if p = 2, then
straightforward in the sense that each step gives a conclusion, and that conclusion gives the (r, q) = (3, 5). Similarly we have two more solutions for the cases when q = 2 or r = 2. Hence
next step, eventually leading us to a solution. However, this is an instructive problem and the solutions are:
an excellent practice for using orders. (p, q, r) = (2, 5, 3), (3, 2, 5), (5, 3, 2).

Example 5.8.1 (USA TST 2003)


Example 5.8.2 (Schinzel)
Find all ordered prime triples (p, q, r) such that p | q r + 1, q | rp + 1, and r | pq + 1.
Find all integers n ≥ 1 such that n divides 2n−1 + 1
First of all, let’s analyze only the condition p | q r + 1 (since the others are symmetric).
This has a very short solution, however is hard to come up with. Assume on the contrary
Now, this gives q r ≡ −1 (mod p). Hence, q 2r ≡ 1 (mod p) and so ordp (q) | 2r. Since r is a
that for some n > 1 we have n|2n−1 + 1. Let p1 < p2 < · · · < pk be the prime divisors of n.
prime, hence ordp (q) ∈ {1, 2, r, 2r}. Not too shabby. Let’s deal with each case properly:
Write pi = 2ri mi + 1 with mi odd for all 1 ≤ i ≤ k. Let t = rj be the minimum of all ri . The
1. Suppose ordp (q) = 1. Then p | q − 1. However, then q r ≡ 1 (mod p) combined with advantage of doing this is
p | q r + 1 implies 1 ≡ −1 (mod p), i.e. p = 2. Y
n= (2ri mi + 1) ≡ 1 (mod 2t ).
2. Suppose ordp (q) = 2. Then p | q 2 − 1 = (q − 1)(q + 1). As before p | q − 1 is impossible i

(unless p = 2). So p | q + 1.
So we can write n = 2t m + 1 with m odd. Since pj = 2t mj + 1, hence
r
3. Suppose ordp (q) = r. Then q ≡ 1 (mod p). This as before implies p = 2 (why?) m j t
 t m m
−1 ≡ (−1)mj ≡ 2n−1 = 2(2 m)mj ≡ 22 mj ≡ 2pj −1 ≡ 1 (mod pj ).
4. Suppose ordp (q) = 2r. Then 2r | p − 1. In particular, p is an odd prime and r | p − 1.
Hence pj = 2, which is clearly impossible.
The rest of the problem is smart casework now. For now, suppose all p, q, r are odd. So, we
have obtained the following result:
Example 5.8.3 (Chinese TST 2005)
Lemma 5.8.1. For odd primes x, y, z, n
Prove that for any n > 2, the greatest prime factor of 22 + 1 is greater than or equal
( to n · 2n+2 + 1.
ordx (y) = 2 =⇒ x | y + 1
x | y z − 1 =⇒
ordx (y) = 2z =⇒ 2z | x − 1 This problem, just like the previous one, is tricky despite having a simple solutions. In
fact our solution will prove a stronger bound (try to point out how and where). Suppose
Suppose ordp (q) = 2r, which gives r | p − 1. This means r | pq − 1 (why?). However, 22 + 1 = pα1 1 . . . pαk k . Now a standard order argument shows pi ≡ 1 (mod 2n+1 ) (we saw this
n

then r | pq + 1 is impossible, since r is odd. Similarly, ordq (r) = 2p of ordr (p) = 2q are not in Example 5.4.3).
possible.
Hence write pi = 2n+1 xi + 1 for each i. Now firstly since pi ≥ 2n+1 + 1, hence
So ordp (q), ordq (r), ordr (p) = 2 implying p | q + 1, q | r + 1, r | p + 1. However, this doesn’t
feel to be possible for primes, because the chain seems to be ”too close”. This intuition is n
22 + 1 ≥ (2n+1 + 1)α1 +···+αk > 2(n+1)(α1 +···+αk ) .
formalized by using inequalities, since these three give p ≤ q + 1, q ≤ r + 1, r ≤ p + 1 and we
can’t find such primes. 2n
Hence, α1 + · · · + αk < n+1
.
At the end of all this discussion, we can conclude that our assumption that p, q, r are Now if we can show xi ≥ 2(n + 1) for some i, then we are done. For this, it is enough to
all odd gives no solution. So, one of p, q, r is even, say p = 2. Then 2 | q r + 1 implies q show that xi (α1 + · · · + αk ) ≥ 2n+1 . How do we get terms of the form xi αi ? The answer is
is odd (and nothing more, so this condition is useless now, i.e. we can’t extract anymore binomial theorem. We get the following:
information from here). Also, q | r2 + 1 implies ordq (r) = 4 (why?) implying 4 | q − 1. Lastly
r | 2q + 1 implies r is odd. So using the lemma we obtain either r | 2 + 1 = 3, or 2q | r + 1. pαi i = (2n+1 xi + 1)αi ≡ 2n+1 αi xi + 1 (mod 22n+2 ).

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 143 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 144
5. Modular Arithmetic Advanced 5. Modular Arithmetic Advanced

(since 2n ≥ 2n + 2 for n ≥ 3. The cases n ≤ 2 can be checked manually). Thus Proof. Let’s suppose the permutations are xM, yM . Suppose we fix yM and move xM .
n
Y Then, by definition, the number k at the ith spot in xM will move to jth spot, where j is
22 = pαi i ≡ (2n+1 αi xi + 1) (mod 22n+2 ) the number written at the ith spot in yM .

and so 2n+1 (x1 α1 + · · · + xk αk ) ≡ 0 (mod 22n+2 ). So if xr is the largest from all of xi , then But clearly j ≡ i · y (mod p) and k = i · x (mod p). Hence the new number at the jth
spot is k = x · i = x · (jy −1 ) = j · (xy −1 ). Hence if set t = xy −1 , then k = tj is the new
xr (α1 + · · · + αk ) ≥ x1 α1 + · · · + xk αk ≥ 2n+1 number at the jth spot.

which gives the desired bound. Hence, the new sequence obtained is tM , which is clearly good.
Lastly, we (again) conclude with a problem which is intertwined between Number Theory Also, as proved above, if we have the sequences xM, yM , then we can get to (x · y −1 )M
and Combinatorics: in the next move by fixing yM .

Example 5.8.4 (ELMO 2010/5) Claim. Let g be a primitive root modulo p. Then from the original sequences AM, BM , we
can get to BM, gM .
2010 MOPpers are assigned numbers 1 through 2010. Each one is given a red slip and
a blue slip of paper. Two positive integers, A and B, each less than or equal to 2010 Proof. Set A = g k and B = g ℓ . Let gcd(k − 1, ℓ) = d and write ℓ = dℓ′ and p − 1 = dz.
are chosen. On the red slip of paper, each MOPper writes the remainder when the Then consider the following moves by fixing BM :
product of A and his or her number is divided by 2011. On the blue slip of paper, he

or she writes the remainder when the product of B and his or her number is divided A = g k 7→ g k · g −l 7→ g k · g −2ℓ · · · g k · g −dzℓ
by 2011. The MOPpers may then perform either of the following two operations:
′ ℓ′ ′ ′
Here, since g −dzℓ = (g p−1 ) ≡ g ℓ , hence we have obtained the sequence (g k · g ℓ )M .
1. Each MOPper gives his or her red slip to the MOPper whose number is written
ℓ′
on his or her blue slip. By repeating this process, we can further reduce ℓ′ to gcd(p−1,ℓ′ )
and so on until we get
reach a number L such that gcd(L, p − 1) = 1.
2. Each MOPper gives his or her blue slip to the MOPper whose number is written
on his or her red slip. Then again by fixing BM , we can get to g k · g −L , · · · g k · g −Ln ≡ g, where k − Ln ≡ 1
modulo p−1 (note that this number n exists since gcd(L, p−1) = 1). Hence we have reached
Show that it is always possible to perform some number of these operations such that gM without disturbing B and we are done.
each MOPper is holding a red slip with his or her number written on it.
To finish it, we have the two sequences BM, gM . Now fix BM and perform moves to get
these p − 1 sequences: BM, (Bg −1 )M, (Bg −2 )M · · · (Bg −(p−1) )M .
We generalize the result by replacing 2011 by p for any odd prime p. It is best done by
experimenting yourself, so do that before reading the solution. Firstly, we define a few terms Note that {B, Bg −1 , Bg −2 , · · · Bg −(p−1) } forms a complete residue class modulo p, hence
for convenience: there will exist the sequence 1M in the sequences listed above, and we are done.
1. Let M denote the ordered set {1, 2, · · · p − 1}. For any real constant 0 < c < p, define
cM := {c, 2c, · · · c(p − 1)}. Note that cM is a complete residue class modulo p. But
for any two 0 < a 6= b < p, the sequences aM, bM are different permutations of M .
2. Call a permutation π of M good if there exists a constant C such that π(M ) = CM .
(Note that not every permutation of M is good.)
3. Next, if we perform the first move (Each MOPper gives his or her red slip to the
MOPper whose number is written on his or her blue slip), then say that we fix blue
and move red. Similar terms exist for the second move.
We have the following claim:
Claim. At any moment, if we have two good permutations, then fixing any one of them and
moving the other will also result in a good permutation.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 145 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 146
5. Modular Arithmetic Advanced 5. Modular Arithmetic Advanced

5.9 Practice Problems Problem 5.9.10 (China 2009). Find all prime numbers p, q such that pq | 5p + 5q . Hints:
163 476 176 88
Problem 5.9.1. Find all n such that 3n + 1 is divisibly by n2 .
Problem 5.9.11. Suppose that p > 3 is prime. Prove that the products of the primitive
Problem 5.9.2. Show than any prime factor q of pp − 1 is ≡ 1 (mod p). roots of p between 1 and p − 1 is congruent to 1 modulo p. Hints: 50 461

Problem 5.9.3 (Fermat). Let p > 3 be a prime. Prove that any positive divisor of 2p +1
is Problem 5.9.12 (Bulgaria National Olympiad). Find all positive integers m and n such
3
of the form 2kp + 1. that  n 
m
22 + 1 22 + 1
Problem 5.9.4 (IMO Shortlist 2006 N2). For x ∈ (0, 1) let y ∈ (0, 1) be the number is divisible by mn. Hints: 322
whose n-th digit after the decimal point is the 2n -th digit after the decimal point of x. Show
that if x is rational then so is y. Problem 5.9.13. Determine all the pairs (p, n) of a prime number p and a positive integer
n for which
Problem 5.9.5. Suppose that k ≥ 2 and n1 , n2 , · · · , nk ≥ 1 be natural numbers having the np + 1
∈ Z.
property pn + 1
n2 | 2n1 − 1, n3 | 2n2 − 1, · · · , nk | 2nk−1 − 1, n1 | 2nk − 1. Hints: 141 396
Show that n1 = n2 = · · · = nk = 1. Hints: 408 16
Problem 5.9.14 (Iran MO 3rd round 2016 finals Number Theory P1). Let p and q
Problem 5.9.6 (Iran 3rd round 2017 Numbers theory final exam P1). Let x and y be prime numbers (q is odd). Prove that there exists an integer x such that
be integers and let p be a prime number. Suppose that there exist relatively prime positive
q | (x + 1)p − xp
integers m and n such that
xm ≡ y n (mod p) if and only if
Prove that there exists an unique integer z modulo p such that q≡1 (mod p).
Hints: 331 320 56 Sol: pg. 290
x ≡ zn (mod p) and y ≡ z m (mod p).

Hints: 193 Problem 5.9.15 (China TST 4 2018 Day 2 Q4). Let p be a prime and k be a positive
integer. Set S contains all positive integers a satisfying 1 ≤ a ≤ p − 1, and there exists
Problem 5.9.7 (China TST 2006). Find all positive integers a and n such that positive integer x such that xk ≡ a (mod p).
Suppose that 3 ≤ |S| ≤ p − 2. Prove that the elements of S, when arranged in increasing
(a + 1)n − an
order, does not form an arithmetic progression. Hints: 257 179
n
is an integer. Hints: 415 Problem 5.9.16 (IMO Shortlist 1998 N5). Determine all positive integers n for which
there exists an integer m such that 2n − 1 is a divisor of m2 + 9. Hints: 102 368 143 183
Problem 5.9.8. Let g be a Fibonacci primitive root (mod p). i.e. g is a primitive root
(mod p) satisfying g 2 ≡ g + 1 (mod p). Prove that Problem 5.9.17 (USA TST for EGMO 2019, Problem 3). Let n be a positive integer
such that the number
1. g − 1 is also a primitive root (mod p). 1k + 2 k + · · · + nk
2. Show that if p ≡ 3 (mod 4), then g − 2 is also a primitive root (mod p). n
is an integer for any k ∈ {1, 2, . . . , 99}. Prove that n has no divisors between 2 and 100,
Hints: 219 354 inclusive. Hints: 28 338 376 387 335 Sol: pg. 291

Problem 5.9.9 (PUTNAM 1976 B6). Prove that if n is an integer such that σ(n) = Problem 5.9.18 (IMO Shortlist 2014 N6). Let a1 < a2 < · · · < an be pairwise coprime
2n + 1, then n is the square of an odd integer. Hints: 106 86 388 278 positive integers with a1 being prime and a1 ≥ n + 2. On the segment I = [0, a1 a2 · · · an ] of

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 147 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 148
5. Modular Arithmetic Advanced

the real line, mark all integers that are divisible by at least one of the numbers a1 , . . . , an .
These points split I into a number of smaller segments. Prove that the sum of the squares
of the lengths of these segments is divisible by a1 . Hints: 375 170 256 26 4 242 222 62 Sol: pg.
291

Chapter 6

Largest Exponent

This chapter is based on the whole idea of looking at prime factors to think of a number, an
idea we hinted to in the first chapter.
Definition 6.0.1. Let p be a prime and n be an integer. Then the p-adic valuation or
p-adic order of n is defined to be the largest integer t such that pt | n.
The are two1 common notations for this. The one we will use is νp (n).
So, ν2 (48) = 4 and ν5 (10) = 1. We can also have νp = 0, for instance ν2 (3) = 0. By
convention, we set νp (0) = +∞. Thus, if we let 2 = p1 < p2 < p3 < . . . be all the primes,
then we can write any integer n as
Y νp (n) ν (n) ν (n)
n= pi i = p1p1 p1p1 . . . .
i≥0

For instance 36 = 22 · 32 · 50 · 70 . . . . Let’s now present one property which is going to be


most important result related to νp :
Lemma 6.0.1 (Divisibility). Let x, y be integers. Then
x | y ⇐⇒ νp (x) ≤ νp (y) for all primes p.
As a corollary, x = y if and only if νp (x) = νp (y) for all primes p.
The key part here is that we must have νp (x) ≤ νp (y) for all primes p. Can you see why
this lemma is true?
This lemma can be used to interchange divisibility with νp , which is very useful at times.
For instance, here is a classic example which is hard to do otherwise but easy using this
lemma. We give a walkthrough to it

Example 6.0.1

Let a, b be integers such that a | b2 | a3 | b4 | a5 . . . . Show that a = b.

The idea is to use νp to remove the divisibility. Also, to show a = b, we must show
νp (a) = νp (b) for all primes p. So take any prime p.
1
The other is ordp (n). However, that clashes with the notation we used for order. So we don’t use that.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 149 157
6. Largest Exponent 6. Largest Exponent

(a) Use a | b2 to get νp (a) ≤ 2νp (b). Use b2 | a3 to get 2νp (b) ≤ 3νp (a). Continue the Lemma 6.1.2 (Quotient). Let x, y be integers and p be a prime. Then
pattern to get  
x
νp = νp (x) − νp (y).
nνp (a) ≤ (n + 1)νp (b) ≤ (n + 2)νp (a) for all n ∈ N. y
We can also replace x, y integers to x, y rational in Lemma 6.1.1 and n to any integer in
(b) Choose n large to conclude that νp (b)/νp (a) = 1 (In other words, take n → ∞). Corollary 6.1.1.
Conclude. Now consider x + y. As before, we have x = pm a, y = pn b with a, b coprime to p. Suppose
m > n. Then
x + y = pm a + pn b = pn (pm−n a + b) (6.1)
6.1 Arithmetic properties
Since m − n > 0, hence p | pm−n a. So the bracket term is coprime to p. Hence νp (x + y) = n.
m
Consider two integers x, y. Suppose νp (x) = m, νp (y) = n. So x = p a, y = p b where a, bn In general νp (m + n) = min{νp (m), νp (n)}.
are coprime to p. Then For instance, if m = 30 and n = 162, then ν3 (30 + 162) = ν3 (192) = 1 = ν3 (30).
xy = (pm a)(pn b) = pm+n ab.
Question 6.1.1. Take m = 30 and n = 6. What is ν3 (m + n)? Does it match with the
Since gcd(ab, p) = 1, hence we find νp (xy) = m + n. We can similarly get νp (x ÷ y) = m − n. formula we got?
So,
If you did the above question, you would realize something is fishy. Can you find the
mistake in our proof?
Lemma 6.1.1 (Product). Let x, y be integers and p be a prime. Then
If you noticed that we did not deal with the case m = n, then well done. When m = n,
νp (xy) = νp (x) + νp (y). we find pm−n = 1, and so the bracket term in Equation 6.1 is (a + b). Now gcd(a, p) =
1 = gcd(b, p) does not guarantee gcd(a + b, p) = 1. So it is possible the (a + b) term also
Thus, νp is an additive function. As a corollary, we find: contributes a power of p, and so νp (x + y) > min{νp (x), νp (y)}. So in general we have the
following lemma:
Corollary 6.1.1 (Exponentation). Let x be an integer and n ∈ N. Let p be a prime. Then
Lemma 6.1.3 (Sum). Let x, y be integers and p a prime. Then
νp (xn ) = nνp (x).
νp (x + y) ≥ min{νp (x), νp (y)},
You might observe the resemblance of this property with logarithms; we have log(xy) =
log(x) + log y and log(xn ) = n log x. and equality holds if νp (x) 6= νp (y).

Just like log(x/y) = log x − log y, we can similarly get that Note a subtle detail here. We have said ”equality holds if” not if and only if. Can you
  reason out why?
x
νp = νp (x) − νp (y) if y | x. Let’s try an example problem now:
y
Example 6.1.1 (IMO Shortlist 2007 N2)
However note that we must have y | x for the division property (otherwise xy won’t be an
integer). This is kind of annoying. To overcome this, we generalize p-adic numbers: Let b, n > 1 be integers. Suppose that for each k > 1 there exists an integer ak such
that b − ank is divisible by k. Prove that b = An for some integer A.
Definition 6.1.1. Let q = m/n be a rational number, where m, n ∈ Z. Let p be a prime.
We define the p-adic valuation of q as Clearly, if b = An , then the constant sequence ak = A works. So this is one of those
problems where the obvious solution is the only one.
νp (q) = νp (m) − νp (n).
Now, we can write the divisibility as νp (b − ank ) ≥ νp (k) for all k and primes p. Now,
So now νp can take rational inputs too. For instance, ν7 (49/10) = 2, ν5 (20/15) = 0 and νp (b − ank ) ≥ min{νp (b), nνp (ak )}. If we can strategically choose k such that νp (b) 6= νp (ank ) =
ν2 (3/4) = −2. Note that νp can be positive, 0 or even negative. We can now ignore the y | x nνp (ak ), then we will know for sure that νp (b − ank ) = min{νp (b), nνp (ak )}. So this is our key
condition to get: idea.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 158 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 159
6. Largest Exponent 6. Largest Exponent

At this point, note that νp (b) = nνp (ak ) =⇒ n | νp (b). So if we suppose a prime p exists Question 6.2.2. Use the formula to show ν3 (8!) = ν3 (7!) = ν3 (6!). Then explain why is this
such that n ∤ νp (b), then we can pick that prime p and we would get true (without using the formula).
νp (k) ≤ νp (b − ank ) = min{νp (b), nνp (ak )} ≤ νp (b) ∀ k > 1. Let’s try and see why this is true. Write

However, the right side is a constant (since b is fixed) but we can pick νp (k) on the left side n! = n(n − 1)(n − 2)(n − 3) . . . 1.
to be as large as we want, meaning that the above is a contradiction. First let’s see how many terms are divisible by p. It’s clearly ⌊n/p⌋ since there are these
This means that for every prime p we have n | νp (b). This precisely means b = An for many multiples of p atmost n.
some A (since b becomes a product of nth power primes) which is what we wanted! Now any term which is divisible by p2 has more contribution than just one factor of p.
The motivation I gave might seem slightly hard to some of you. So here’s a nicely written There are ⌊n/p2 ⌋ terms divisible by p2 that are atmost n. These have a contribution of 2.
solution which is different (even though the idea is exactly the same). However, we counted them once before so we only need to count them once now. So we add
Proof. Assume on the contrary that b is not a perfect nth power, which is the same as saying ⌊n/p2 ⌋ .
there is a prime p with n ∤ νp (b). Then write Similarly we account for terms divisible by p3 by adding ⌊n/p3 ⌋ and so on. A diagram
representation of this proof for n = 12 and p = 2 is shown:
b = pxn+y ℓ, 1 ≤ y ≤ x − 1.
(x+1)n
1 2 3 4 5 6 7 8 9 10 11 12
Now pick k = p . Then xn + y = νp (b − ank ) ≥ νp (k) = (x + 1)n, a contradiction. ν2 ≥1 1 1 1 1 1 1 ⌊12/2⌋
ν2 ≥2 1 1 1 ⌊12/4⌋
ν2 ≥3 1 ⌊12/8⌋
Comment 6.1.1: Note that we could have chosen k to be any very large power of p so
ν2 ≥4 ⌊12/16⌋
that xn + y > νp (k). The key part in the problem is that n ∤ νp (b) =⇒ νp (ank ) 6= νp (b) .. .. .. .. .. .. .. .. .. .. .. .. .. ..
and so νp (b − ank ) = νp (b). . . . . . . . . . . . . . .

νp (9!) = 1 + 2 + 1 + 3 + 1 + 2 = ⌊12/2⌋ + ⌊12/4⌋ + ⌊12/8⌋ + ⌊12/16⌋ + . . .


Problems for Practice
Let’s try a simple problem now:
Problem 6.1.1. Show that a rational number q is an integer if and only if νp (q) ≥ 0 for
every prime p. Example 6.2.1

Show that for any positive integer n,


6.2 Legendre’s Formula  
2n
Apart from Wilson’s theorem, we haven’t talked much about factorials. One of the most | lcm{1, 2, . . . , 2n}.
n
useful properties is the following, which is surprisingly ubiquitous:

Theorem 6.2.1 (Legendre’s Formula). Let n be an integer and p a prime. Then Pick a prime p. Then we have to prove νp 2n n
≤ νp (lcm{1, 2, . . . , 2n}) . The right side
is max{νp (1), νp (2), . . . , νp (2n)} (why?). We can write the left side as (2n)!/(n!)2 and use
X  n  n  n   n 
νp (n!) = = + 2 + 3 + .... Legendre to evaluate its νp . So we just have to prove
pi p p p X  2n   
i≥1 n
max{νp (1), νp (2), . . . , νp (2n)} ≥ νp ((2n)!) − 2νp (n!) = − 2 .
Question 6.2.1. The right side is an infinite sum. The left side, however is finite obviously. i≥1
pi pi
How is this possible?
At this point, note that each term in the summand on the right is of the from ⌊2x⌋ − 2 ⌊x⌋ .
For instance, We would like to bound this. We do this by writing x = ⌊x⌋ + {x} to get
         ⌊2x⌋ − 2 ⌊x⌋ =
6 6 6 6 ⌊2{x}⌋ ∈ {0, 1}. Also, note that the right side becomes 0 for i > logp (2n) . So, we find
ν2 (6!) = + 2 + 3 + 4 + · · · = 3 + 1 + 0 + 0 + · · · = 4.
2 2 2 2 X  2n   
n  
i
− 2 i ≤ logp (2n) .
Also, 6! = 720 = 24 × 45. So our formula works well. i≥1
p p

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 160 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 161
6. Largest Exponent 6. Largest Exponent

 
At this point we are done, since logp (2n) is the maximum power of p that occurs in a However, since νp (n!) is an integer, hence this gives
number ≤ 2n, which is precisely the same as max{νp (1), νp (2), . . . , νp (2n)}. So we are done.  
n
Turns out there’s another formula for νp (n!), which is useful for simple bounding: νp (n!) ≤ ≤ νp (Q),
p−1
Theorem 6.2.2. For any prime p and integer n, if sp (n) denotes the sum of digits of n
when written in base p, then and we are done.
n − sp (n)
νp (n!) = .
p−1
Problems for Practice
This is not very hard to prove, and is left as an exercise. For p = 2, this gives ν2 (n!) = Problem 6.2.2. Prove Theorem 6.2.2 by writing the base p representation of n as n =
n − s2 (n), which is quite useful. For instance, it trivializes the following problem: nk pk + nk−1 pk−1 + · · · + n0 .

Problem 6.2.1 (Canada). Find all n such that 2n−1 divides n!.
6.3 Revisiting GCD and LCM
For a much more interesting example using this ν2 (n!) formula, see Example 6.6.1. For
now, here’s a nice and challenging example: This notation provides us with a very convenient way of writing the GCD and LCM formula
given as Lemma 1.6.3:
Example 6.2.2
Lemma 6.3.1. Let m, n be integers. Then for every prime p, we have
Prove that for all positive integers n, n! divides
n−1
νp (gcd(m, n)) = min{νp (m), νp (n)}
Y
P = n k
(2 − 2 ). νp (lcm(m, n)) = max{νp (m), νp (n)}.
k=0
This lemma makes problems related to GCD and LCM both easier to manage, especially
n(n−1) easier to write (and explain).
Firstly, take out 2k from every bracket (2n −2k ). Thus ν2 (P ) = 0+1+· · ·+(n−1) = 2
.
This is clearly larger than ν2 (n!) = n − s2 (n) ≤ n − 1. Now, write
Example 6.3.1
Q = (2n − 1)(2n−1 − 1)(2n−2 − 1) . . . (2 − 1).
Prove that lcm(a, b, c)2 | lcm(a, b) lcm(b, c) lcm(c, a) for any positive integers a, b, c.
We need to show that νp (n!) ≤ νp (Q) for all odd primes p (why?). We first estimate νp (Q).
For that, we need to look at how many terms of the form 2x − 1 are divisible by p. Now,
Pick any prime p and let x = νp (a), y = νp (b), z = νp (c). The problem is equivalent to
p | 2p−1 − 1 by Fermat’s Little Theorem, so p | 2k(p−1) − 1 for all k. So the weakest estimate
showing
on νp (Q) is the number of k for which
j k(pk − 1) ≤ n, i.e. the number of multiples of (p − 1)
n 2νp (lcm(a, b, c)) ≤ νp (lcm(a, b)) + νp (lcm(b, c)) + νp (lcm(c, a)),
that are less than n. This is clearly p−1
. So,
  which is equivalent to 2 max{x, y, z} ≤ max{x, y} + max{y, z} + max{z, x}. But this is clear
n (for instance, assume without loss of generality that x ≥ y ≥ z).
νp (Q) ≥ .
p−1

This is a weak and naive estimate (since even if p | 2k(p−1) − 1, the power of p in 2k(p−1) − 1 6.4 Lifting The Exponent (LTE)
might be more than 1) and so we have no guarantee if it would work. However, there is no
harm in trying. Multiplication is fine, when we want to think of the valuation of the product. However, sum
j k
Let’s try to see if we can show νp (n!) ≤ p−1n
. Looking at the p − 1, we are motivated of two quantities can get weird, especially in the case when νp (a) = νp (b). In this section we
to try Theorem 6.2.2. So, look at a particular type of sums whose νp we can calculate. Suppose, for instance, we want
n − sp (n) n to find
νp (n!) = < . n 
p−1 p−1 ν 3 43 − 1 .

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 162 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 163
6. Largest Exponent 6. Largest Exponent

We know this is divisible by 3 for all odd k (why do we need odd k?). However, since
Comment 6.4.2: Point out in the proof where we used the three important conditions: νp (a + 1) + 1 is fixed, hence we can choose (odd) k such that νp (a + 1) + νp (k) + 1 6≡ 0
p > 2, p ∤ a, b and p | a − b. (mod 3), which is a contradiction. Hence, our assumption that a + 1 has an odd prime factor
was false. So a + 1 can’t have an odd prime factor.
Now, for the general result, we induct on νp (n) = k (kind of like what we did in the
Write a + 1 = 2k . Here’s the clever trick now: since gcd(a2 + 1, a + 1) = gcd(a + 1, 2) = 2,
problem). The case n = 0 is not hard (left as an exercise). Assume the result till some k,
hence a2 + 1 will have an odd prime factor p if k > 1 (why?). So, you can repeat the process
and we want to prove it for k + 1.
above with a2 instead of a and still get a contradiction (convince yourself that this argument
We simply use the lemma to get (first verify the three conditions) works). Hence, k = 1, meaning a + 1 = 2, i.e. a = 1, as needed.
 p p 
νp (an − bn ) = νp an/p − bn/p
Comment 6.4.3: In problems like these (involving find all solutions, or prove this is
= νp (an/p − bn/p ) + 1 the solution), when we write a proper proof, we must show two things: the solution
= νp (a − b) + νp (n/p) + 1 = νp (a − b) + νp (n). works, and second this is the only solution. Most people often miss the first, thinking
it’s trivial, and lose marks on an actual Olympiad. So, the starting line of our solution
So we are done (point out where we used the induction hypothesis.). to this problem would be: ”Clearly, a = 1 works since then 4(1n + 1) = 8 for all n,
which is a cube. Now, we will show this is the only possibility.” The proof we gave
Let’s take a look at some examples: follows after this. Don’t miss this ”obvious” statement and lose marks!
Example 6.4.1

Prove that for any natural n, Example 6.4.3 (AMM)


n
ν3 (23 + 1) = n. ac −bc
Let a, b, c be positive integers such that c | ac − bc . Prove that c | a−b
.
This is similar to LTE, with a plus instead of a minus. If n is odd, we can change b to
−b to obtain the following form of LTE: This problem calls for LTE. So we first establish the 3 conditions. Suppose c ≥ 3. Pick
an odd prime p | c (that’s why we need c ≥ 3). If p ∤ a − b, the result is obviously true. So
Lemma 6.4.3. LTE for addition Let p > 2 be a prime and a, b ∈ Z be coprime to p such suppose p | a − b.
that p | a − b. Suppose n is an odd positive integer.
If p divides one of a or b, then p must divide the other (why?). Write νp (a) = x, νp (b) =
νp (an + bn ) = νp (a + b) + νp (n). y, νp (c) = z. Suppose x > y. Then we just need z ≤ y(c − 1). However, since c ≥ pz > z + 1
(why?) hence z ≤ yz ≤ y(c − 1) holds true. If x = y, then take pcx out and ignore it.
Now let’s look at some real examples: We prove the result for the leftover part only, in which case p ∤ a∗ , b∗ , where a∗ , b∗ are the
leftovers from a, b respectively. So now assume p ∤ a, b.
Example 6.4.2 (Iran 2008 Round 2 Day 2/1) Upto this point we have just established the conditions for LTE. Now, using LTE,
Let a be a natural number. Suppose that 4(an + 1) is a perfect cube for every natural  c
a − bc

number n. Prove that a = 1 νp (ac − bc ) = νp (a − b) + νp (c) =⇒ νp (c) ≤ νp .
a−b
If an odd prime p divides an + 1 for some n, then νp (an + 1) must be divisible by 3, since This is what we needed. Now, we just need the result for p = 2. For this case, we can’t apply
gcd(p, 4) = 1. This is the key insight. LTE. So we need something new:
Now, we are clearly motivated to try LTE by looking at νp (an + 1). So, we want the 3
conditions. By assumption, p > 2. Also, p ∤ a (why?). We just want p | a + 1 and n odd. So
let’s start by this assumption. Pick an odd prime p divisor of a + 1, if it exists (when does 6.5 The sad case when p = 2
it not exist?). Then by Fermat’s Little Theorem, p | a + 1 | apk + 1 for all k. So, by LTE
We particularly asked you to remember that the formula does not work with p = 2. But
νp (apk + 1) = νp (a + 1) + νp (k) + 1 ∀ odd k. what if we want ν2 ? We have the following result in this case:

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 166 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 167
6. Largest Exponent 6. Largest Exponent

Lemma 6.5.1 (LTE for p = 2). Let x, y be odd integers such that 2 | x − y. Let n be an even 6.6 Example Problems
integer. Then

ν2 (xn − y n ) = ν2 (x2 − y 2 ) + ν2 (n/2) = ν2 (x − y) + ν2 (x + y) + ν2 (n) − 1. Example 6.6.1 (Paul Erdos)

Note here that n must be even, We have another result for p = 2, wherein we don’t need Prove that there exists a constant c such that for any positve integers a, b and n > 1
2 | n (however we need 4 | x − y) : satisfying a! · b! | n!, we have a + b < n + c log n.

Lemma 6.5.2. Let x, y be odd integers such that 4 | x − y. Then This is an analytic kind of problem. A common theme in many of these is to make use
of simple number theoretic facts and estimates. Often the simplest estimates give very good
ν2 (xn − y n ) = ν2 (x − y) + ν2 (n).
(at times, optimal) bounds.
The proof for these 2 are not very different, just some care is needed with the base case. In this problem, the given condition gives νp (a!) + νp (b!) ≤ νp (n!) for any prime p. The
The full proof is left to the interested readers. key trick at this point is to consider p = 2, to get a − s2 (a) + b − s2 (b) ≤ n − s2 (n) (since
the problem wants us to prove something involving a, b, n not a!, b!, n!, hence making use of
ν2 (x!) = x − s2 (x) is slightly motivated). So, we get

a + b − n ≤ s2 (a) + s2 (b) − s2 (n).

If we can show the right side is at most c log n for some constant c, we are done. At this point,
we need upper bounds on s2 (a), s2 (b). The simplest upper bound is obtained by considering
the case when all of the digits of a, b in base 2 are 1. Thus, s2 (a) ≤ ⌊log2 (a)⌋ + 1 (why?) and
so
a + b − n ≤ log2 (a) + log2 (b) + 2 − s2 (n) ≤ log2 (ab) + 2 ≤ 2 log2 (n) + 2,
where, we used ab < n × n = n2 ands2 (n)> 0. The result is now immediate, since the right
side is 2 log2 (n) + 2 ≤ 4 log2 (n) = log4 2 log n. (these are just rough estimates. The key
point is that log2 (n) + 2 = O(log n)).
The next is a great example showing how simple uses of νp can be really powerful.

Example 6.6.2 (APMO 2017/4)

Call a rational number r powerful if r can be expressed in the form pk /q for some
relatively prime positive integers p, q and some integer k > 1. Let a, b, c be positive
rational numbers such that abc = 1. Suppose there exist positive integers x, y, z such
that ax + by + cz is an integer. Prove that a, b, c are all powerful.

We need to consider a prime p and show that if νp (a) > 0, then it is divisible by some
fixed k > 1, which is independent of p (why?). Firstly, the condition abc = 1 translates to

νp (a) + νp (b) + νp (c) = 0.

Assume that νp (a) > 0. By the above, at least one is negative. If νp (b) > 0 while νp (c) < 0,
then νp (ax + by + cz ) < 0, which is impossible since it’s an integer.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 168 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 169
6. Largest Exponent 6. Largest Exponent

Here, we used νp (d) = 0 since 1 < d ≤ p − 1. This gives


Comment 6.6.1: Before we move on, here’s a tip on how to think about νp in such
problems. If νp (x) = y, think of y as px , not as cpx , This makes it easier to think about d −1) pn 3n
operations. So, for instance the above argument can be thought of as pn ≤ pνp (a pνp (n) ≤ (ad − 1)n ≤ ab n =⇒ ab > ≥ . 
n n
1 p• + p• + 1
ax + by + cz = p• + p• + = .
p• p•
Of course, there would be a constant in place of 1s, but the idea is that it won’t be
divisible by p. So the numerator above isn’t divisible by p while the denominator is,
giving νp (ax + by + cz ) < 0.
Even when we think about νp (a + b) ≥ min{νp (a), νp (b)}, it is easiest to think of
a = px , b = py . So if x > y, then a + b = py (px−y + 1) and so the bracket is coprime to
p implying νp (a + b) = y. However, if x = y, the bracket becomes 1 + 1, which means
some constant+constant which might be divisible by p.

Hence, we obtain νp (b), νp (c) < 0. In this case, if νp (ax + by + cz ) ≥ 0, we must have that
νp (bx ) = νp (cz ) (confirm this both by giving a formula argument (by writing νp (a) = u, . . . ),
and by convincing yourself by the way described in the comments above).
Hence, xνp (b) = yνp (c). If gcd(x, y) = d and x = x∗ d, y = y ∗ d, then we must have
νp (b) = kx∗ and νp (c) = ky ∗ for some k. Hence,

νp (a) = −(νp (b) + νp (c)) = −k(x∗ + y ∗ ).

Hence νp (a) is always divisible by x∗ + y ∗ which is independent of p. So we are done.

Comment 6.6.2: The most reasonable way to motivate the last step is to take an
example. If 4νp (b) = 6νp (c), then (νp (b), νp (c)) can be (3, 2), (6, 4), (9, 6), . . . . It is now
6k
easy to see that νp (b) must be of the form 3k = gcd(4,6) and νp (c) must be of the form
4k
2k = gcd(4,6) .

The next problem is again analytic in nature, and again shows how simple ideas work
when used properly.

Example 6.6.3 (China TST 2009 Quiz 6/1)

Let a > b > 1 be positive integers and b be an odd number, let n be a positive integer.
n
If bn | an − 1, prove that ab > 3n .

Since b is odd, it has a prime factor p. So an ≡ 1 (mod p) implying d = ordp (a) | n.


Further, νp (an − 1) ≥ nνp (b). We can use LTE as
n
n ≤ nνp (b) ≤ νp ((ad )n/d − 1) = νp (ad − 1) + νp = νp (ad − 1) + νp (n).
d
c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 170 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 171
6. Largest Exponent 6. Largest Exponent

6.7 Practice Problems Problem 6.7.8. Prove that if the odd prime p divides ab − 1, where a and b are positive
integers, then p appears to the same power in the prime factorization of b(ad − 1), where
Problem 6.7.1. Show that if n ≥ 6 is composite, then n divides (n − 1)!. d = gcd(b, p − 1). Hints: 355 244

Problem 6.7.2. Let p be an odd prime. For any t ≥ 1, define Problem 6.7.9 (PUTNAM). Show that for each positive integer n,
p−1 n
Y n j n ko
X t
St = kp . n! = lcm 1, 2, . . . , .
i=1
i
k=1

Then prove that νp (St ) ≥ t + 1. In particular, Hints: 121

2 p p p
p | 1 + 2 + ··· + p . Problem 6.7.10. Let n be a positive integer with n > 1.
Hints: 419 412 1. Prove that the nth Harmonic number defined by
2n

Problem 6.7.3. Show that | lcm(1, 2, . . . , 2n) for all positive integers n. Hints: 295 217 1 1
n Hn = 1 + + ··· +
2 n
Problem 6.7.4 (USAMO 1975/1). Prove that is not an integer. Hints: 318 55 315
⌊5x⌋ + ⌊5y⌋ ≥ ⌊3x + y⌋ + ⌊3y + x⌋ ,
2. Prove that
1 1
where x, y ≥ 0. Using this or otherwise, prove that 1+ + ··· +
3 2n − 1
(5m)!(5n)! is not an integer. Hints: 161 107
m!n!(3m + n)!(3n + m)!
2n +1
is integral for all positive integral m and n. Hints: 325 187 Problem 6.7.11 (IMO 1990/3). Find all natural n such that n2
is an integer. Hints:
452 214 300

Problem 6.7.5. Prove that for all integers n ≥ 1,


  Problem 6.7.12 (IMO 1999/4). Find all pairs of positive integers (x, p) such that p is
1 2n prime, x ≤ 2p, and xp−1 | (p − 1)x + 1. Hints: 238 470 474 373
Cn = ∈ Z.
n+1 n
Problem 6.7.13 (Taiwan TST 2018 Round 2 Quiz 3/1). Given a square-free positive
(The number Cn is called the nth Catalan Number. It is an interesting object of study integer n. Show that there do not exist coprime positive integers x, y such that xn + y n is a
in enumerative combinatorics) multiple of (x + y)3 . Hints: 98 169 189

Problem 6.7.6. Find all positive integers n such that 3n − 1 is divisible by 2n . Hints: 434 Problem 6.7.14 (China TST 1 2019/4). Call a sequence of positive integers {an } good
if for any distinct positive integers m, n, one has
Problem 6.7.7 (Austria National Competition Final Round). Let a, b, and c be
integers such that gcd(m, n) | a2m + a2n and gcd(am , an ) | m2 + n2 .
ab ac bc Call a positive integer a to be k-good if there exists a good sequence such that ak = a. Does
+ +
c b a there exists a k such that there are exactly 2019 k-good positive integers? Hints: 432 348 74
is an integer. Prove that each of the numbers
Problem 6.7.15 (Indian TST 2018 Day 2/1). For a natural number k > 1, define Sk
ab ac bc to be the set of all triplets (n, a, b) of natural numbers, with n odd and gcd(a, b) = 1, such
, , and
c b a that a + b = k and n divides an + bn . Find all values of k for which Sk is finite. Hints: 298
is an integer. Hints: 399 334 185 151 361 290

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 172 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 173
6. Largest Exponent 6. Largest Exponent

Problem 6.7.16 (Gabriel Dospinescu). Let a, b be two distinct positive rational numbers one considers the infinite sequence
such that for infinitely many integers n, an −bn is an integer. Prove that a, b are also integers.
Hints: 79 347 443 ca − db
ca2 − db2
Problem 6.7.17 (Iran 3rd round 2017 Number theory first exam P1). Let n be a ca3 − db3
positive integer. Consider prime numbers p1 , . . . , pk . Let a1 , . . . , am be all positive integers ca4 − db4
less than n such that are not divisible by pi for all 1 ≤ i ≤ n. Prove that if m ≥ 2 then ..
.
1 1
+ ··· + and looks at the highest power of p that divides each of them, these powers are not all zero,
a1 am
and are all at most M . Prove that there exists some T (which may depend on a, b, c, d, p, M )
is not an integer. Hints: 153 488 356 433 Sol: pg. 293 such that whenever p divides an element of this sequence, the maximum power of p that
divides that element is exactly pT . Hints: 313 146 267 317 Sol: pg. 294
Problem 6.7.18 (China TST 2 2019/4). Set positive integer m = 2k · t, where k is a
non-negative integer, t is an odd number, and let f (m) = t1−k . Prove that for any positive Problem 6.7.24 (ELMO Shortlist 2017 N3). For each integer C > 1 decide whether
integer n and for any positive odd number a ≤ n, f (1)f (2) . . . f (m) is a multiple of a. Hints: there exist pairwise distinct positive integers a1 , a2 , a3 , . . . such that for every k ≥ 1, akk+1
178 247 342 Sol: pg. 293 divides C k a1 a2 , . . . , ak . Hints: 337 72 456 359 Sol: pg. 295

Problem 6.7.19 (IMO Shortlist 2014 N5). Find all primes p and positive integers (x, y) I know I promised no functional equations in this book. However this problem is one of
such that xp−1 + y and y p−1 + x are powers of p. Hints: 134 60 31 my all time favorites:

Problem 6.7.25 (USA TSTST 2019 Day 3/1). Let f : Z → {1, 2, . . . , 10100 } be a
Problem 6.7.20 (Tuymaada Olympiad). Prove that the equation
function satisfying
1 1 1 1 gcd(f (x), f (y)) = gcd(f (x), x − y)
= + + ··· +
10n n1 ! n2 ! nk ! for all integers x and y. Show that there exist positive integers m and n such that f (x) =
gcd(m + x, n) for all integers x.
does not have integer solutions such that 1 ≤ n1 < · · · < nk . Hints: 117 441 473 92 274 Sol: pg.
294

Problem 6.7.21 (USAMO 2009/6). Let s1 , s2 , s3 , . . . be an infinite, nonconstant sequence


of rational numbers, meaning it is not the case that s1 = s2 = s3 = . . . . Suppose that
t1 , t2 , t3 , . . . is also an infinite, nonconstant sequence of rational numbers with the property
that (si − sj )(ti − tj ) is an integer for all i and j. Prove that there exists a rational number
r such that (si − sj )r and (ti − tj )/r are integers for all i and j. Hints: 12 201 249 367

Problem 6.7.22 (India TST 2019 Day 1/2). Show that there do no exist natural num-
bers a1 , a2 , . . . a2018 such that all

(a1 )2018 + a2 , (a2 )2018 + a3 , . . . , (a2018 )2018 + a1

are powers of 5. Hints: 70 478 280 303

Problem 6.7.23 (USA TSTST 2014/6). Suppose we have distinct positive integers
a, b, c, d, and an odd prime p not dividing any of them, and an integer M such that if

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 174 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 175
6. Largest Exponent 6. Largest Exponent

z Zsigmondy’s Theorem Example 6.7.4 (IMO Shortlist 2000 N4)

We have seen expressions of the form ak − bk occur a lot in many problems. There is one Find all triplets of positive integers (a, m, n) such that am + 1 | (a + 1)n .
theorem in particular that is very useful in such expressions:
Over here, any prime divisor of am + 1 must divide a + 1. We can’t use Zsigmondy here,
Theorem 6.7.1 (Zsigmondy’s Theorem). Let a, b be coprime positive integers. Then for since it involves a − sign instead of a +. This need calls for a second version of the theorem:
any integer n > 1, an − bn has a prime factor that does not divide ak − bk for any k < n,
except in the following cases: Theorem 6.7.2 (Zsigmondy’s Variant). Let a, b be positive coprime integers. Then for any
integer n > 1, there exists a prime factor of an + bn that does not divide ak + bk for any
• 26 − 16 k < n, except for the case:

• n = 2 and a + b is a power of 2. • 23 + 13 .

Such a prime divisor is called a primitive prime divisor of an − bn . Proof. Consider a primitive divisor of a2n − b2n (excluding the exceptions). Then p | an + bn
or p | an − bn , the latter being rejected since p is primitive. This p works.
So an − bn always (except a few cases) has a new prime factor. This theorem is very hard
to prove despite having an elementary proof (unlike say, Dirichlet’s Theorem). The proofs As for the exceptions, the case 26 − 16 is reflected in 23 + 13 . The second exception of
dwells a lot upon many properties of Cyclotomic Polynomials, a topic we avoid in this book. n = 2 and a + b a power of 2 is ignored since we only consider n > 1 in the theorem.

This theorem is delicate, and is not allowed to be used in all Olympiads. So be careful As for our problem, if m > 1, then am + 1 has a prime factor that a + 1 doesn’t unless
before using it on an exam. For now, however, let’s nuke some problems using this! (a, m) = (2, 3). Hence, the only solutions are (a, m, n) = (a, 1, n), (2, 3, n).

Example 6.7.1 (Polish MO 2010 Round 1) Example 6.7.5 (IMO Shortlist 2002 N3)
pq
Let p and q be prime numbers with q > p > 2. Prove that 2 − 1 has at least three Let p1 , p2 , . . . , pn be distinct primes greater than 3. Show that 2p1 p2 ···pn + 1 has at least
distinct prime factors. 4n divisors.

Observe that 2p −1 and 2q −1 both divide 2pq −1. Now, since q, p > 2, hence by Zsigmondy, Let e = p1 p2 . . . pn . Then e has 2n divisors. Also, 3 ∤ e, and so by Zsigmondy, 2e + 1 has
n
both 2pq − 1 has a prime factor that does not divide 2p − 1, 2q − 1. Further, q > p > 2, so at least 2n prime factors. So, a total of 22 > 22n = 4n divisors.
2q − 1 has a prime factor that does not divide 2p − 1. So we are done. Let’s try two challenging problems that aren’t directly trivialized by Zsigmondy’s Theo-
rem.
Example 6.7.2 (1994 Romanian Team Selection Test)
Example 6.7.6 (IMO Shortlist 2000/5)
Prove that the sequence an = 3n − 2n contains no three terms in geometric progression
Does there exist a positive integer n such that n has exactly 2000 prime divisors and
Say ai aj = a2k with i < k < j. However, aj has a prime factor that ak does not by n divides 2n + 1?
Zsigmondy’s theorem, hence we already have a contradiction.
The answer is yes, and we prove it for any k instead of just 2000. They key idea is to add
Example 6.7.3 primes one by one. Suppose we have n such that n | 2n + 1 and n has k prime factors. We
want to find a prime p such that np | 2np + 1 and p ∤ n.
Let a be an integer. Prove that for any d, there exist infinitely many primes p such
that d | ordp (a). To have p | 2np + 1, we would take a prime p | 2n + 1. Now we need to ensure p ∤ n. Since
n | 2ϕ(n) − 1, hence we are done if we can ensure p ∤ 2ϕ(n) − 1.
Consider numbers of the form adn − 1. For any n (such that we avoid an exception), by Here’s how we do this: By Zsigmondy, pick a primitive prime factor p of 22n − 1. Then
Zsigmondy, there would exist a primitive prime factor p of adn − 1. Then ordp (a) = dn. So p ∤ 2n − 1, so p ∤ 2n + 1. Further, p ∤ 2ϕ(n) − 1 as ϕ(n) < 2n, so p ∤ n. Hence, np | 2np − 1 and
Zsigmondy trivialized a very hard problem. we are done.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 176 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 177
6. Largest Exponent 8. Quadratic Residues

Example 6.7.7 (Iran third round 2018 NT/4 (weaker version)) 8.1 How to find them?
Prove that for any natural numbers a, b there exist infinity many prime numbers p so This is the first question we try to answer. The naive answer is to find all the elements
that ordp (a) ≥ ordp (b). {12 , 22 , 32 , . . . , (p − 1)2 } (mod p). Instead of first writing all the elements of this set, then
removing repetitions, let’s try to directly do this.
The proof I present is quite magical. Take a prime q and pick a primitive prime factor p
of aq − bq using Zsigmondy’s Theorem. It is not hard to check that ordp (ab−1 ) = q. The key Suppose 0 < i, j < p such that i2 ≡ j 2 (mod p). Then p | (i − j)(i + j), so that p | i − j
claim is the following: or p | i + j. The latter case corresponds to i ≡ −j (mod p). The first case is not possible.
Thus, if we consider the following set X
Claim. One of ordp (a), ordp (b) is divisible by q. n 2 o
X = 12 , 22 , . . . , p−1
2
(mod p),
We first show how this claim finishes the problem: Suppose q | ordp (a), and write
ordp (a) = qx. Then 1 ≡ aqx ≡ bqx (mod p) implies ordp (b) | qx, which gives ordp (a) ≥ ordp (b)
then we find that any two elements in X are distinct. Further, for any number i > (p − 1)/2,
as desired. Now we prove the claim:
we have i2 ≡ (p − i)2 , and p − i < (p − 1)/2. So, X is the set of ALL the quadratic residues
Proof. Since ordp (ab−1 ) = q, we get q | p − 1. Write p = qk + 1. mod p. This gives us the following:
We also know that ordp (a), ordp (b) | p − 1 = kq. So if the claim isn’t true, then Lemma 8.1.1 (Number of Quadratic Residues). For any prime p, there are exactly p−1
2
ordp (a), ordp (b) | k. Then non-zero quadratic residues. Further, they are given by the set
k
ak ≡ 1 ≡ bk a · b−1
( 2 )
(mod p) =⇒ ≡1 (mod p). 
p−1
12 , 22 , . . . , (mod p).
−1 ∗
Hence, q = ordp (ab ) | k. So write k = qk , so p = q k + 1. 2 ∗ 2

Now, the finishing argument is that we can repeat the above process and show q | k ∗ , This also implies that there are (p − 1)/2 quadratic nonresidues.
and keep going on forever, which is a contradiction.
Some problems for you to try: This simple fact alone can help us solve the following problem:
Example 8.1.1
Problem 6.7.26 (IMO Shortlist 1997, Q14). Let b, m, n be positive integers such that
b > 1 and m 6= n. Prove that if bm − 1 and bn − 1 have the same prime divisors, then b + 1 Let p be a prime. Show that the congruence x2 + y 2 + 1 ≡ 0 (mod p) always has a
is a power of 2. solution (x, y).

Problem 6.7.27. Let a ∈ N prove that the set Assume p odd, since this is clear for p = 2. Now, we know that there are p+1 2
elements
  in the set {0, 1, 2, . . . , p − 1} that can be written as x2 for some x. Further, by the same
p−1 logic there are p+1 elements in the set {0, 1, 2, . . . , p − 1} that can be written as −1 − y 2 for
: gcd(p, a) = 1, p prime 2
ordp (a) some y. Since these add to p + 1 while {0, 1, . . . , p − 1} only has p elements, some two must
overlap, which is what we wanted (why?).
is unbounded.

Problem 6.7.28 (USA TSTST 2018/8). For which positive integers b > 2 do there exist Problems for Practice
infinitely many positive integers n such that n2 divides bn + 1?
Problem 8.1.1. Prove that the sum of quadratic residues mod p is congruent to 0, if p > 3.

Problem 8.1.2. Show that the product of quadratic residues mod p is +1 if p ≡ 1 (mod 4),
and −1 otherwise.1
1
Does this seem familiar? This was used in the first proof of Fermat’s Christmas Theorem (the one
without primitive roots), where we directly put x = ((p − 1)/2)! and showed x2 ≡ −1.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 178 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 212
8. Quadratic Residues 8. Quadratic Residues

8.2 Multiplication Using the Legendre’s symbol, we basically have converted the English question ”is x a
quadratic residue” to a mathematical expression. For instance, we have the following lemma,
This is the first non-trivial question we try to answer. This will motivate a genius notation that English couldn’t have allowed us to write:
which will form the base of the theory of quadratic residues. Suppose you have two squares.
Theorem 8.2.2 (Euler’s criterion). Let p be a prime. Then
Then their product is obviously a square. So, the product of two QRs is a QR.
 
What about QR × NQR? Well, intuitively it doesn’t feel right for this to be a square. a p−1
≡a 2 (mod p).
Indeed, if x2 y ≡ z 2 (mod p), then y ≡ (z · x−1 )2 (mod p), contradicting the fact that y is a p
NQR (note here that we are dealing with quadratic residues).
Finally, what is a NQR × NQR? Try and guess the answer (maybe take a few examples). For instance, if a = x2 is a QR, then the left side is 1 and the right side is (x2 )(p−1)/2 =
For instance, if n is a NQR, then n × n = n2 is a QR. Turns out that in general the product xp−1 ≡ 1 (mod p). The interesting case is when a is a NQR. The easiest way to prove this
will always be a QR! Here’s one ingenious proof: is use the following:

Suppose n is a NQR. Let q = (p − 1)/2 and X = {x1 , x2 , . . . , xq } be the set of QRs and Lemma 8.2.2 (Primitive Roots and Quadratic Residues). Let g be a primitive root modulo
Y = {y1 , y2 , . . . , yq } be the set of NQRs. Then p. Then for any a 6≡ 0 (mod p), write a = g k . Then a is a quadratic residue if and only if k
is even.
X ∪ Y = {1, 2, 3, . . . , p − 1} = S,
This is easy to prove, and I leave it as an exercise (this was also Problem 5.5.4). Back to
where S is the set of all non-zero residues modulo p. Now, by Theorem 2.5.1, nS ≡ S
Euler’s Criterion, write a = g k with k odd. Then a(p−1)/2 ≡ g k(p−1)/2 ≡ −1 (mod p) (why?).
(mod p). However, since a NQR times a QR is a NQR, hence nX must be the set of NQRs
Hence we are done.
(since it has q elements). This means that nY must be the set of QRs, and so n times any
NQR is a QR, which is what we wanted to prove! Thus we have the following:
Comment 8.2.1: We know that every non-zero number is a root of the polynomial
Lemma 8.2.1. We have the following (remember that we are dealing with non-zero residues) xp−1 − 1 in Fp . So,
p−1 p−1
1. QR × QR = QR; p | x 2 − 1 or p | x 2 + 1.
2 p−1
2. QR × N QR = N QR; We know that every number of the form 12 , . . . , p−1 2
is a root of x 2 − 1. By
Lagrange’s Theorem (Theorem 5.9.4), we know that this polynomial has at most deg =
3. N QR × N QR = QR. p−1
roots in Fp [X]. Hence, these all are the only roots of this polynomial (why?) and
2
So the same category objects give QR, and opposite category gives N QR. Does this so every quadratic nonresidue satisfies
remind of you something? p−1
x 2 ≡ −1 (mod p).
This should ring a bell and motivate you to think of +1, −1, since the ”same category
idea” is everywhere; multiplication by negative integers, labelling of positive and negative Hence we have given an alternate proof of Euler’s Criterion.
charges, magnetic poles, dipoles, rotation etc. This idea motivates giving a +1 to a QR, and
a −1 to a NQR. This is how we do it: Lemma 8.2.1 is very useful, and is sufficient to solve a lot of problems. An amazing
Definition 8.2.1. Let p be a prime, and x be an integer. Then we define the Legendre’s example is the following:
notation as 
   1 if x is a QR Example 8.2.1
x
= 0 if x ≡ 0 (mod p) √
p 
 Prove that for a prime p > 3, the smallest quadratic nonresidue is less than p.
−1 otherwise

Thus, Lemma 8.2.1 gives us the following very useful property: The idea is simple, pick the smallest quadratic nonresidue r, and try to show r < p. The
first thing we can do is to use the definition of r to get that {1, . . . , r − 1} are all quadratic
Theorem 8.2.1 (Legendre’s Symbol is completely multiplicative). Let a, b be integers and residues.
p a prime. Then     
a b ab Now, since r is a NQR, hence ra is a NQR for any QR a. In particular, {r·1, . . . , r·(r−1)}
= . √ √
p p p are all NQRs. Now, if r > p (note that r cannot equal p) then r2 > p. This means r2

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 213 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 214
8. Quadratic Residues 8. Quadratic Residues

”crosses” p. Here’s the idea: If r2 lands on a number in {1, . . . , r − 1}, we have something For instance, q = 3 implies
interesting. However, we can’t control where r2 lands. But this is a good idea.    
3 p p−1
If we try to mend this idea, we look at numbers of the form r, 2r, . . . , (r − 1)r. Consider = · (−1) 2 .
p 3
the first number that crosses p, say ra.2 Hence, by definition,
Thus, 3 is a quadratic residue mod p if and only if p ≡ ±1 (mod 12) (why?). If q = 5, then
ra > p > r(a − 1).    
5 p
= .
(why not ≥?). Hence, we get p + r > ra > p. Hence, ra mod p lies in {1, 2, . . . , r − 1}, which p 5
means it must be a QR, a contradiction! Thus, 5 is a quadratic residue mod p if and only if p ≡ ±1 (mod 5). Interesting right?
We will see a generalization of this result in the chapter ”Constructions.” Let’s use this to evaluate something scary like 21

. We have
61
        
21 3 7 QR 3−1 61−1 61 7−1 61−1 61
Problems for Practice = = (−1) 2 · 2 (−1) 2 · 2
61 61 61 3 7
Problem 8.2.1. Give an example of two nonresidues that don’t multiply to give a residue   
1 5
mod 12. Hence conclude that Lemma 8.2.1 doesn’t always hold in no-prime moduli. =
3 7
   
QR 5−1 7−1 7 2
Problem 8.2.2. Prove that any quadratic residue can’t be a primitive root modulo p. = (−1) 2 · 2 = = −1.
5 5
Problem 8.2.3. Prove Lemma 8.2.2. So 21 is not a quadratic residue mod 61.
Again, we left out the case p = 2. The poor case always gets left out from all the big
Problem 8.2.4. Use Euler’s Criterion to prove that the Legendre’s symbol is completely
theorems, but is never ignored; here’s the result with p = 2 :
multiplicative.
Theorem 8.3.2 (Criterion for 2). For any odd prime p,
Problem 8.2.5. Show that for any prime p,  
p2 −1
2
  = (−1) 8 .
−1 p−1 p
= (−1) 2 .
p In other words, 2 is a quadratic residue modulo p if and only if p ≡ ±1 (mod 8).
We don’t prove Quadratic Reciprocity for now. There’s a classic proof that we won’t
8.3 The Law of Quadratic Reciprocity discuss. We do, however, present a special and non-standard proof in the special section at
the end.
We now try to investigate if there’s a nice formula to find the Legendre’s symbol. For this
purpose, we have the following beautiful theorem:
Comment 8.3.1: There’s a very beautiful theorem which states that if a number is
Theorem 8.3.1 (Quadratic Reciprocity Law). Let p 6= q be odd primes. Then a quadratic residue mod p for all but finitely many prime numbers, then it is square
   number. This is not just an amazing result, but useful too. You can find some
p q p−1 q−1 applications of this in the book [14]. This, however, is not very easy to prove. It is
= (−1) 2 · 2 .
q p given as an exercise problem (with solution) in the chapter ”Constructions”.

This is a very powerful theorem, and is amazing in its own right. If you want to find
Let’s try some simple examples now.
(p/q), you can instead calculate (q/p).

Question 8.3.1. Explain the significance of ”reciprocity” in the theorem’s name. Example 8.3.1
2
Why must such an a exist? This is the idea of discrete continuity. Since r ·1 < p but r ·r > p, hence there Prove that if a prime p is a quadratic residue of an odd prime q, and p is of the form
must exist an a ∈ (1, p) such that ra > p but r(a − 1) < p. Despite being extremely useful and ubiquitous, 4k + 1, then q is a quadratic residue of p.
it is quite a simple idea.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 215 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 216
8. Quadratic Residues 8. Quadratic Residues

This is a direct application of quadratic reciprocity: Just recall that {an + b} forms the complete residue class mod p if gcd(a, p) = 1. So
   
q p−1 q−1 p q−1 p 
an + b
 p  
n
= (−1) 2 · 2 = (−1)2k· 2 · 1 = 1.
X X
p q = = 0,
n=1
p n=1
p
Question 8.3.2. Where did we use the fact that q is odd?
since there are an equal number of QRs and NQRs.
Example 8.3.2 This was a simple example. However, what if we had a quadratic in place of an + b?
This method fails there. We need a more general method. So let’s try to find a more general
The last digit of the number x2 + xy + y 2 is zero (where x and y are positive integers). method. Since we can’t exactly pin-point when an + b would be a QR, our best bet would be
Prove that two last digits of this numbers are zeros. to try something algebraic. Which identity can convert the Legendre symbol into something
algebraic?
The problem statement in itself is very interesting. We basically want to show if 10 |   p−1
x2 + xy + y 2 , then 102 also divides this. Firstly, if 2 | x2 + xy + y 2 , then one can easily check Yes, Euler’s criterion. So an+b
p
≡ (an + b) 2 (mod p). This is something we could
that we must have x ≡ y ≡ 0 (mod 2). Hence, 4 | x2 + xy + y 2 . try, however there is a cost: we would be able to find the value (mod p) but not the exact
Now suppose 5 | x2 + xy + y 2 . Again, if 5 | x, y, we are done like before. Also, if 5 divides value. But let’s try this anyway for now. Also, a thing we can do is
one of x, y, it divides both. So assume 5 divides neither. Hence,     
an + b a n+c
=
5 | 4(x2 + xy + y 2 ) =⇒ (2x + y)2 ≡ −3y 2 (mod 5). p p p
−1 2
 
So, −3 = (2x · y + 1) (mod 5) is a quadratic residue (since 5 ∤ y). Hence, where c ≡ b · a−1 (mod p) (we used p ∤ a here). Now, we just evaluate the sum n+c . We
p
     p−1
−3 −1 3 have (let w = 2
)
1= =
5 5 5 p   p
 
5
X n+c X
5−1 3−1 5−1
= (−1) 2 · (−1) 2 · 2 ≡ (n + c)w
3 n=1
p n=1
  p
2 X  
w w−1

= = −1. ≡ nw + n c + · · · + cw (mod p)
3 1
n=1

So we have a contradiction. Hence 5 | y =⇒ 5 | x, and so 52 | x2 + xy + y 2 , and we are How do we evaluate the above sum? Firstly, write this as:
done.
p     p
!   X p
! p
!
X w w−1 X w X
nw + n c + · · · + cw = nw + c nw−1 + · · · + cw n0 . (8.1)
Problems for Practice n=1
1 n=1
1 n=1 n=1

Problem 8.3.1. If a is a quadratic nonresidue of each of the odd primes p and q, is x2 ≡ a So now we just need sums of the form 1i + 2i + · · · + pi . Does this ring a bell? Recall:
(mod pq) solvable?
Lemma 8.4.2 (Sum of Powers mod p). Let p > 2 be a prime. Then for any integer x,
(
8.4 Legendre Symbol Manipulation −1 if p − 1 | x
1x + 2x + · · · + (p − 1)x ≡ (mod p).
0 otherwise
This section is better understood by examples than words. Let’s try to prove the following:

Lemma 8.4.1. If gcd(a, p) = 1 and p is an odd prime, then Using this, we see that each sum in Equation 8.1 is 0, and hence the original sum is 0.
Thus,
p   p  
X an + b X an + b
= 0. ≡ 0 (mod p).
n=1
p n=1
p

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 217 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 218
8. Quadratic Residues 8. Quadratic Residues

Now we have to deal with the issue we mentioned earlier: how do we find the exact value? Question 8.4.1. As usual, where did we need p > 2? Why did we consider 0 along with the
Here’s the trick. If S is the sum we want, then S ≡ 0 (mod p). Also, it involves the sum of quadratic residues here? Also, what happens if gcd(a, p) 6= 1? What does the sum evaluate
p Legendre symbols, each of which is atmost 1 and at least −1. Hence, to in that case?

−p ≤ S ≤ p. Using this, we can obtain the following:

So, S ∈ {−p, Corollary 8.4.1. Let p be an odd prime and a, b be integers both coprime to p. Then
 0, p}.
 We have to eliminate the possibilities S = p and S = −p. Note that
S = p if all an+b
p
= 1, which means all an + b are quadratic residues. However, since p > 2, Xp 
an2 + b
  
a
this is impossible. Similarly S =
6 −p and we are done. = .
n=1
p p
This seemingly long method has a merit: it can be generalized more easily. Try to prove
the following yourself first, as the method is the same.  
a
To prove this, just multiply our previous lemma by p
. Also think why we need a, b
Lemma 8.4.3. Let p be an odd prime and a be an integer with gcd(a, p) = 1. Then both coprime to p.
p  2 
X n +a
= −1. Problems for Practice
n=1
p
Problem 8.4.1. Show that p  2 
We again employ the same method, however this time write it without explaining each X n +a
step. = (p − 1)
n=1
p

p  2  p if p | a.
X n +a X p−1
S= ≡ (n2 + a) 2
n=1
p n=1 Problem 8.4.2. Use Corollary 8.4.1 and a suitable transformation to prove:
p    
X (p − 1)/2 p−2 p−1 Let a, b, c be integers and let p be an odd prime with p ∤ a. Then
= np−1 + n a + ··· + a 2
1 p    
n=1 X an2 + bn + c a
if p | b2 − 4ac.
!  ! !
p  X p p = (p − 1)
X
p−1 (p − 1)/2 p−3
p−1 X
0 p p
= n + a n + ··· + a 2 n n=1
n=1
1 n=1 n=1 p    
≡ −1 (mod p)
X an2 + bn + c a
=− otherwise.
n=1
p p
So, S ≡ −1 (mod p). However, we can see that |S| ≤ p − 1. Hence, S ∈ {−1, p − 1}.
 2  This is the most general form of quadratic and hence the most useful result. Keep this in
We have to eliminate the possibility that S = p−1. Note that S = p−1 if all n p+a = 1, mind. There’s another form which is often useful: If a, b are not congruent, then
2
which means n2 +a is quadratic residues for all 1 ≤ n ≤ p. Thus, {02 +a, 12 +a, . . . , p−1 2
+a} X p 
(n + a)(n + b)

is precisely the set of all quadratic residues including 0 (why?), i.e. = −1.
n=1
p
n 2 o n 2 o
02 + a, 12 + a, 22 + a, . . . , p−1
2
+ a ≡ 02 , 12 , 22 , . . . , p−1
2
(mod p).
8.5 Points on the circle x2 + y 2 ≡ 1 in Fp
We need to somehow show this is not possible. What’s the first thing we do for equal sets?
Yes, add and equate the elements. We get The title is self-explanatory; we try to solve the following equation:
2  2 
02 + 12 + · · · + p−1
2
≡ (02 + a) + (12 + a) + · · · + p−1
2
+a (mod p). x2 + y 2 ≡ 1 (mod p).

p+1

Hence, 2 a ≡ 0 (mod p), which means a ≡ 0 (mod p). However the statement includes Problem 8.5.1. Use the method from Example 8.1.1 to sow that x2 + y 2 + 1 ≡ 0 (mod p)
gcd(a, p) = 1, and so this is impossible! Hence S =
6 p − 1 and so S = −1, and we are done. always has a solution x, y ∈ Fp .

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 219 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 220
8. Quadratic Residues 8. Quadratic Residues

Does this mean the end of our discussion? Certainly not. Suppose p = 7 so that the QRs Theorem 8.5.1. Let p be an odd prime. Let N be number of solutions to x2 + y 2 ≡ a
are {0, 1, 2, 4}. Hence, we can list all possible values of x2 + y 2 (mod 7) as: (mod p) with x, y ∈ Fp . Then

02 12 22 32 42 52 62 p + (p − 1)(−1) p−1
2 if a ≡ 0 (mod p)
02 0 1 4 2 2 4 1 N=
p − (−1) p−1 otherwise
12 1 2 5 3 3 5 2 2

22 4 5 1 6 6 1 5
32 2 3 5 4 4 5 3
42 2 3 5 4 4 5 3
Problems for Practice
52 4 5 1 6 6 1 5
62 1 2 5 3 3 5 2 Problem 8.5.2. Prove Theorem 8.5.1.
2 2
We see that there are 8 solutions to x + y ≡ 1 (mod 7). So, now we ask: how many Problem 8.5.3. Show that the number of solutions to x2 − y 2 ≡ a (mod p) for x, y ∈ Fp is
solutions does x2 + y 2 ≡ 1 (mod p) have? p − 1. This represent the number of points on the hyperbola x2 − y 2 = a in Fp .
Directly counting with two variables is hard. So, we count the number of 1s in each row
and add all of them. That is, we fix y = c, and see how many x exist. So, our question is
how many solutions does x2 ≡ 1 − c2 (mod p) have. Once we answer this (in terms of c), we
sum the number of solutions as c goes from 0 to p − 1.
Since we have fixed c, we have 1 − c2 = a is a constant. So we ask: how many solution
does x2 ≡ a (mod p) have? Clearly it’s 2 when a is a QR and 0 when a is a NQR (and 1 if
a = 0). There’s a nice algebraic way to write this:
Lemma 8.5.1. The number of solutions to x2 ≡ a (mod p) for a fixed a is
 
a
1+ .
p
Hence, the number of solutions to x2 ≡ 1 − c2 (mod p) is
 
1 − c2
1+ .
p
Thus, the number of solutions to x2 + y 2 ≡ 1 (mod p) is
p−1    X p−1  2 
X 1 − c2 −1 c −1 p−1
1+ =p+ = p + (−1) 2 · (−1).
c=0
p p c=0
p
p−1
Hence, x2 + y 2 ≡ 1 (mod p) has p − (−1) 2 solutions. So, we have shown
Lemma 8.5.2. The number of solutions to x2 + y 2 ≡ 1 (mod p) for an odd prime p and
x, y ∈ Fp is
p−1
p − (−1) 2 .

For instance, when p = 7, this gives 7 − (−1)3 = 8, exactly what we had before. This
also implies something interesting: the equation x2 + y 2 ≡ 1 (mod p) always has a solution,
and at least p − 1 of them.
We can generalize the above result to get

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 221 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 222
8. Quadratic Residues 8. Quadratic Residues

8.6 Example Problems This means (2x · y −1 + 1)2 ≡ −3 and so −3 is a quadratic residue. However, since p ≡ 2
(mod 3),  
−3 p−1 p−1  p 
Quadratic residues are really powerful in problems, especially Olympiad problems. Let’s 1= = (−1) 2 · (−1) 2 = −1.
start by a classic example p 3
This is a contradiction.
Example 8.6.1
Now we do a challenging problem, which is a great example problem involving quadratic
Prove that 2n + 1 has no prime factor of the form 8k − 1. residues.

Suppose p | 2n + 1, so that 2n ≡ −1 (mod p). Now, clearly p 6= 2 and so this gives Example 8.6.3 (Taiwan TST?)
ordp (2) = 2n (why?).
Suppose that ϕ(5m − 1) = 5n − 1 for a pair (m, n) of positive integers. Prove that
If n is even, then 2n ≡ −1 (mod p) above implies that −1 is a quadratic residue and so gcd(m, n) > 1.
p ≡ 1 (mod 4), meaning p cannot be of the form 8k − 1.
If n is odd, then 2n+1 ≡ −2 (mod p) implying −2 is a QR. However, Assume on the contrary, and assume m > 2. Then note that
 
−2 p−1 p2 −1 gcd(5m − 1, 5n − 1) = 5gcd(m,n) − 1 = 4.
1= = (−1) 2 + 8 .
p
In particular, 5m − 1 is square free, and min{ν2 (5m − 1), ν2 (5n − 1)} = 2. Write 5m − 1 =
So if p ≡ −1 (mod 8), then the above is impossible. So we are done. 2e p1 p2 . . . pk with pi pairwise distinct odd primes. Clearly k > 0 for m > 2 (by Zsigmondy,
say). Then ν2 (5n − 1) ≥ (e − 1) + k ≥ e and so e = 2. In particular, m is odd. Thus, we can
Now a problem which has a surprisingly simple solution, but is not easy by any means. write
5n − 1 = 2(p1 − 1)(p2 − 1) . . . (pk − 1). (8.2)
Example 8.6.2 (Iran TST 2013)
Now, consider the following crucial claim:
Prove that for positive integers x, y, z, the number x2 + y 2 + z 2 is not divisible by
2013(xy + yz + zx). Claim. Suppose p | 5m − 1 for some odd prime p 6= 5, where m > 2 is odd. Then p ≡ ±1
(mod 5).
The 2013 is sitting there just because of the exam year. Now 2013 = 3 × 11 × 61. We
only need the factor of 3. Proof. Assume p ≡ ±2 (mod 5). Then
2
 
Assume on the contrary. Clearly we can assume that gcd(a, b, c) = 1. Now write x + 5 p−1 5−1  p 
= (−1) 2 · 2 · = −1.
y 2 + z 2 = 3k(xy + yz + zx) so that p 5

(x + y + z)2 = (3k + 2)(xy + yz + zx). So 5 = g ℓ for some primitive root g (modulo 5) and non-negative odd integer ℓ. But then
2 | p − 1 | mℓ, a contradiction since m, ℓ are odd.
Here is the key idea: Since 3k + 2 ≡ 2 (mod 3), hence there exists at least one prime factor
p of 3k + 2 so that p ≡ 2 (mod 3) and it has an odd exponent in 3k + 2, otherwise the prime Thus, pi ≡ ±1 (mod 5) for all i. However, by taking Equation (8.2) modulo 5, we must
factors multiply to give a number which is ≡ 1 (mod 3). have pi ≡ −1 (mod 5) for all i. Then
So, there exists a prime p ≡ 2 (mod 3) such that νp (3k + 2) is odd. But then p | x + y + z
−1 ≡ 5m − 1 = 4p1 p2 . . . pk ≡ 4(−1)k (mod 5)
and so p | xy + yz + zx as νp (3k + 2) is odd. So
−1 ≡ 5n − 1 = 2(p1 − 1) . . . (pk − 1) ≡ 2(−2)k (mod 5).
p | xy + z(x + y) ≡ xy − (x + y)2 =⇒ p | x2 + xy + y 2 .
However, it is easy to see these two equations can’t hold simultaneously. So we are done.
This in particular means that if p | y, then p | z, x too contradicting the gcd assumption. So Last, we solve a challenging problem with a surprising application of quadratic residues.
p ∤ y.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 223 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 224
8. Quadratic Residues 8. Quadratic Residues

Example 8.6.4 (AOPS 2019 IMOTC Thread) 8.7 Practice Problems


p−1
If p > 3 is a prime such that ϕ(p − 1) > 3
, then there are two consecutive primitive Problem 8.7.1. For a given prime p > 3, define S = {03 , 13 , 23 , · · · (p − 1)3 }. Then prove
roots modulo p. that S is a complete residue class mod p if and only if p ≡ 2 (mod 3).

Assume not. Let g be a primitive root, which means g −1 is also a primitive root. Now, Problem 8.7.2 (Iran third round number theory exam 2015/3). Let p > 5 be a prime
by our assumption, neither of g + 1, g −1 + 1 is a primitive root. However, number and A = {b1 , b2 , . . . , b p−1 } be the set of all quadratic residues modulo p, excluding
2
zero. Prove that there doesn’t exist any natural a, c satisfying (ac, p) = 1 such that set
g · (g −1 + 1) ≡ g + 1 (mod p). B = {ab1 + c, ab2 + c, . . . , ab p−1 + c} and set A are disjoint modulo p. Hints: 442
2

Now, since a primitive root is always a quadratic nonresidue, hence g is a quadratic non-
residue and so the above implies that exactly one of g + 1, g −1 + 1 is a quadratic nonresidue Problem 8.7.3 (Indian TST). Suppose that p is an odd prime and that A and B are two
(why?), say g+1. Then the set {g, g −1 , g+1} is a set of three quadratic nonresidues. Associate different non-empty subsets of {1, 2, . . . , p − 1} for which
this (that is, create a map) from g to this set.
1. A ∪ B = {1, 2, . . . , p − 1};
Now note that g 6≡ g −1 (mod p) for any primitive root g, Also, g, g −1 map to the same
set, and no two primitive roots map to the same set unless they are the same or inverses. 2. If a, b are both in A or both in B, then ab (mod p) ∈ A;
So, the image set of this map is half of the number of primitive roots, which is ϕ(p − 1)/2.
3. If a ∈ A, b ∈ B, then ab (mod p) ∈ B.
Since each set haS 3 quadratic nonresidues, hence there are at least
Find all such subsets A and B.
ϕ(p − 1) p−1
3· >
2 2 Problem 8.7.4. A prime p is called a Sophie-Germain prime if 2p + 1 is also a prime.
Show that if p ≡ 1 (mod 4), then 2 is a primitive root mod 2p + 1. Hints: 96 228
quadratic nonresidues by the given hypothesis. However, this is a contradiction, and we are
done.
Problem 8.7.5 (Iranian Third round Number theory exam 2015/5). p > 5 is a
prime number. Prove that one of the following numbers is in form of x2 + y 2 .

p + 1, 2p + 1, 3p + 1, . . . , (p − 3)p + 1.

Hints: 475 283

Problem 8.7.6 (IMO Shortlist 1991). Let p > 3 be a prime and let a, b, c be integers
with a 6= 0. Suppose that ax2 + bx + c is a perfect square for 2p − 1 consecutive integers x.
Prove that p divides b2 − 4ac. Hints: 393

Problem 8.7.7 (Vietnam TST 2005/5 Part a). Let p be a prime number of the form
4k + 1. Show that
p−1  2   2 
X 2i i p−1
−2 = .
i=1
p p 2
Hints: 340

Problem 8.7.8 (RMM 2013/1). For a positive integer a, define a sequence of integers
x1 , x2 , . . . by letting x1 = a and xn+1 = 2xn + 1 for n ≥ 1. Let yn = 2xn − 1. Determine
the largest possible k such that, for some positive integer a, the numbers y1 , . . . , yk are all
prime. Hints: 42 364 150

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 225 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 226
8. Quadratic Residues 8. Quadratic Residues

Problem 8.7.9 (Romania TST 2008). Let a and b be positive integers such that 2a − 1 Problem 8.7.18 (USOMO 2020/3). Denote by A the set of all integers a such that
divides 3b − 1. Prove that either a = 1 or b is even. Hints: 17 33 1 ≤ a < p, and both a and 4 − a are quadratic nonresidues. Calculate the remainder when
the product of the elements of A is divided by p. Hints: 239 171 35 139 Sol: pg. 302
Problem 8.7.10 (Gabriel Dospinescu). Prove that for any positive integer n, the number
n
23 + 1 has at least n prime divisors of the form 8k + 3. Hints: 282 68 54

Problem 8.7.11 (IMO 1996/4). The positive integers a and b are such that the numbers
15a + 16b and 16a − 15b are both squares of positive integers. What is the least possible
value that can be taken on by the smaller of these two squares? Hints: 160 466 142

Problem 8.7.12. Let p be a prime number of the form 4k + 1. Prove that


p−1
4 jp k
X p2 − 1
jp = .
j=1
12

Hints: 446 431 269

Problem 8.7.13 (AMM). Find all positive integers n such that 2n − 1 | 3n − 1. Hints: 165
65 Sol: pg. 299

n
Problem 8.7.14 (Taiwan 1997). Let n be a positive integer and let k = 22 + 1. Show
k−1
that k is a prime if and only if k divides 3 2 + 1. Hints: 352 118 174 Sol: pg. 299

Problem 8.7.15 (ELMO 2011/5). Let p > 13 be a prime of the form 2q + 1, where q is
prime. Find the number of ordered pairs of integers (m, n) such that 0 ≤ m < n < p − 1 and
3m + (−12)m ≡ 3n + (−12)n (mod p).
Hints: 97 175 266 344 Sol: pg. 299

p−1
Problem 8.7.16 (Iran TST 2020/6). p is an odd prime number and n = 2
. Find all
n-tuples (x1 , x2 , . . . , xn ) ∈ Fnp such that
n
X n
X n
X
xi ≡ x2i ≡ · · · ≡ xni (mod p).
i=1 i=1 i=1

Hints: 212 333 263 208 232 Sol: pg. 300

Problem 8.7.17 (USA TST 2014/2). Let a1 , a2 , a3 , . . . be a sequence of integers, with the
property that every consecutive group of ai ’s averages to a perfect square. More precisely,
for every 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 the same perfect square). Hints: 211 326 371 Sol: pg. 301

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 227 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 228
9. Constructions

hence this is safer than crossing out the possibility of a construction existing/not-existing
altogether.

9.1 Dirichlet’s Theorem


Chapter 9 In this section, we will discuss a beautiful theorem due to Dirichlet. Let P denote the set of
odd primes, which is infinite. Pick a number, say 4. Then any prime in P is of the form 4n+1
or 4n + 3. By symmetry, it would make sense if there are an equal number of primes of the
Constructions form 4n+1 and 4n+3. Turns out this is true, however ”symmetry” is not the right argument
(remember that primes don’t behave nicely and have no good patterns). In particular, the
number of primes of the form 4n + 1 is infinite, and the same holds for primes of the form
4n + 3.
Existence type problems are very common, not just in Number Theory, but all fields of
Suppose now we consider P modulo 6. Then clearly any prime is either 6n + 1 or 6n + 5
maths. When you are asked to show the existence of something, you might either explicitly
(why?). Again, primes, despite not having any pattern, are equally distributed in the sets
give a construction, or somehow show its existence implicitly, for instance a probabilistic
{6n + 1} and {6n + 5}. In particular, there are infinitely many primes of the form 6n + 1.
proof of existence.
In general, we have the following beautiful theorem:
Constructions don’t always occur as problems, often as ideas in other problems too,
especially where you have a lot of freedom with variables. Choosing the right variables to Theorem 9.1.1 (Dirichlet’s Theorem). Let a, b be coprime integers. Then the arithmetic
work with is the main task in these. Hence, this chapter is valuable in all sorts of problems progression {an + b}n≥0 contains infinitely many primes.
In this chapter, we will focus on two main ideas:
Question 9.1.1. Why do a, b have to be coprime?
1. Existence: Use methods to show the existence directly instead of explicitly writing
down the object. This would (could) involve the use Chinese Remainder Theorem,
Dirichlet’s Theorem and Thue’s Lemma1 . Comment 9.1.1: In fact, Dirichlet’s theorem is stronger than this. It says that
the primes are equally distributed over the ϕ(a) arithmetic progressions of the form
2. Hands-on Constructions: These would involve writing down the object manually {an + x} where x varies over the ϕ(a) integers less than a that are coprime to it. So,
and showing it works. These problems belong more to the combinatorial family which the ”density” of primes in {an + b} is
makes them hard, since there aren’t a lot of fixed techniques that can work. You have
to get your hands dirty on a lot of approaches and see which one works the best. You 1
.
might have to use some theorems (like the Chinese Remainder Theorem) to guarantee ϕ(a)
existence, but the way in which you use it would require a construction type logic. You can think of this by imagining prime numbers as points being distributed equally
Just as an advice: Often problems of the form ”Do(es) there exist” are harder than over the ϕ(a) sets {an + x}, where x varies over positive integers coprime to a. You
simple ”prove this” ones, because you don’t know the answer. Hence, you should rely on can also think of this as the probability that a randomly chosen prime is of the form
your intuition, but still have an open heart to both possibilities. At times, there might be an an + b, i.e. ≡ b (mod a). For example, a randomly chosen prime has the probability
obscure construction, to which believing its existence is harder than actually constructing it. 1/ϕ(4) = 1/2 of being of the form 4n + 1.
Assuming that no construction exists in these problems can lead you to a death trap. Hence, Density is a formal term in Number Theory, and even though is pretty much what
a good idea is to start constructing, see if what you tried fails, see if you can fix it. By this you think it is, we won’t dwell much on that side of analytic number theory. For our
approach you might even find a convincing reason as to why no construction is possible, and purposes, the fact that the number of primes are infinite in each AP is sufficient.

1
It can argued that these are actually hands-on construction methods, since you are explicitly setting up This theorem is amazing, since it not only says a prime p ≡ a (mod b) will exist, but also
congruence relations. However, it really depends on the problem, and these methods could be either. For
instance, in a problem asking you to show there exists a prime ≡ 2 (mod 7), the use of Dirichlet’s theorem
that there will be infinitely many such primes! The proof of this theorem is way beyond the
works as an existence type proof. However, in a problem in which you show p ≡ 2 (mod 7) satisfies the desired scope of the book and uses something known as Dirichlet’s L-function, which is an extensive
condition and just use Dirichlet to guarantee its existence, the argument is a hands-down construction. topic for study in itself.

233 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 234
9. Constructions 9. Constructions

This theorem is very useful. Let’s look at one simple application. If you look closely, you will realize this is an AP with common difference 21, which means it
is the set of integers x such that x ≡ 16 (mod 21). We can quickly check if our guess is true.
Example 9.1.1 If x = 21k + 16, then x ≡ 16 ≡ 2 (mod 7) and x ≡ 16 ≡ 1 (mod 3). Hence, any number 16
modulo 21 satisfies Equation 9.1!
Show that there are infinitely many positive numbers n that cannot be written as
3ab + a + b for any a, b ∈ N. However, does any other integer satisfy Equation 9.1?
Question 9.2.1. Check (prove) that any other number does not satisfy the system in Equa-
For instance, 10 = 3ab + a + b has no solution in positive integers (check this). We need tion 9.1 by taking an x with x 6≡ 16 (mod 21). So basically the pattern we observed is good
to show there are infinitely(!) many more. enough.
One of the first things we try in these problems is factorization. So write n = 3ab + a + b Let’s now look at a different system.
for some a, b, n. Trying to factor the right side doesn’t yield anything useful. However, if we (
multiply both the sides by 3 and add 1 to both the sides (Simon’s trick) we get x≡1 (mod 3)
x≡1 (mod 6)
n = 3ab + a + b ⇐⇒ 3n + 1 = 9ab + 3a + 3b + 1 = (3a + 1)(3b + 1).
Again, you can check that the solution set is:
Nice! This tells us that 3n + 1 is composite. So, if we want to find n such that n = 3ab + a + b
{. . . , −5, −2, 1, 4, 7, 10, 13, 16, 19, 22, . . . }∩{. . . , −5, 1, 7, 13, 19, . . . } = {. . . , −5, 1, 7, 13, 19, . . . }.
does not have a solution, one thing we can try is to keep 3n + 1 a prime. For example, when
n = 10, 3n + 1 = 31 and so 31 = (3a + 1)(3b + 1) will have no solution pair (a, b). So in this case, the solution set is x ≡ 1 (mod 6). If we think about it now, it’s obvious why
this is true; if x = 6k + 1, then x is automatically 1 (mod 3) as 3 | 6.
Now we just want infinitely many such n such that 3n + 1 is a prime. However, this
directly follows from Dirichlet’s Theorem! One last example: (
x≡1 (mod 6)
x≡2 (mod 9)
9.2 Chinese Remainder Theorem
Here, the set satisfying x ≡ 1 (mod 6) is
Suppose we want an x such that x ≡ 2 (mod 7). Then we can pick anything from the set
{. . . , −5, 1, 7, 13, 19, . . . }.
{. . . , −5 , 2, 9, 16, . . . }. Suppose now we want an x such that
( The set satisfying x ≡ 2 (mod 9) is
x ≡ 2 (mod 7)
{. . . , −16, −7, 2, 11, 20, 29, . . . }.
x ≡ 1 (mod 7)
Try as hard as you want, but you won’t find a common element. Why is this true?
Clearly, there is no solution to this system. Let’s look at something more interesting. If x satisfies both, then there exist k, ℓ such that 6k + 1 = x = 9ℓ + 2. However, both
( sides don’t match modulo 3.
x ≡ 2 (mod 7)
(9.1) So, we can our summarize our idea: the classes obtained for two numbers that have a
x ≡ 1 (mod 3)
common factor are not completely independent of each other. However, if they are coprime,
Any x satisfying the first congruence lies in the set we do sense an independence. This is the intuition behind the Chinese Remainder Theorem:
Theorem 9.2.1 (Chinese Remainder Theorem). Let a1 , a2 , . . . , an be integers, and b1 , b2 , . . . , bn
A = {. . . , −19, −12, −5, 2, 9, 16, 23, 30, 37, 44, 51 . . . }. be pairwise coprime integers, i.e. gcd(bi , bj ) = 1 for any i 6= j. Then the system of equations

Any number satisfying the second congruence lies in the set x ≡ a1 (mod b1 )



x ≡ a2 (mod b2 )
B = {. . . , −8, −5, −2, 1, 4, 7, 10, 13, 16, 19, 23, 26, 29, 32, 37, 40, 43, . . . }. ..


 .
Then a solution x to the two equations must be in A ∩ B, which we can check is the set 
x ≡ a (mod b )
n n

A ∩ B = {. . . , −5, 16, 37, . . . }. has a unique solution (mod b1 b2 . . . bn ).

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 235 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 236
9. Constructions 9. Constructions

We developed the intuition for the case n = 2. The general case is quite similar, and the where the first step follows by Fermat’s Little Theorem. Hence, our claim is true and we are
proof is just by induction with the base case n = 2. I leave it as an exercise for the interested done.
readers.
Let’s see an example on how to find the x : Comment 9.2.1: If you try and follow the main theme of the book here, which is to
look at the larger picture, you would write all the values of xx mod p. You can ease
Example 9.2.1
your work using Fermat’s Little Theorem to get xp−1 ≡ x0 . So the set of values of xx
Solve the system of linear congurences: looks like:
00 11 ... (p − 1)0
( 1
x≡3 (mod 5) p (p + 1) . . . (2p − 1)p−2
2

(2p)0 (2p + 1)1 . . . (3p − 1)p−3


x≡4 (mod 8)
(3p)p−2 (3p + 1)0 . . . (4p − 1)p−4
.. .. .. ..
. . . .
To solve this, we first use the fact that there must exist k, ℓ such that x = 5k + 3
and x = 8ℓ + 4. Equating them, we find 5k + 3 = 8ℓ + 4, i.e. 5k = 8ℓ + 1. Modulo 5, You observe that the bases and the powers move along different periods, and differ
this implies 3ℓ + 1 ≡ 0 (mod 5), so ℓ ≡ −3−1 ≡ 3 (mod 5). So write ℓ = 5n + 3 to get just by 1. Also, the numbers with exponent 1 in the list are p1 , (2p + 1)1 , (3p + 2)1 , . . .
x = 8(5n + 3) + 4 = 40n + 28. Note that this satisfies both the congrunces. Note that the bases cover all the residues mod p so eventually we will also get c1 ≡ c
(mod p), which is what we want. So we basically found a new proof to this problem!
Question 9.2.2. Where was the fact that gcd(8, 5) = 1 used?
This argument is perfect. However, the beauty of the Chinese Remainder Theorem
This theorem is incredibly useful in constructing an x when we want it to satisfy many is that we don’t have to explicitly make this table; the theorem contains it without
properties. Cleverly picking these conditions can help solve some very challenging construc- having to explicitly write it down!
tion based problems.

Example 9.2.2 The best way to use CRT in a lot of construction type problems is the following:

Show that for c ∈ Z and a prime p, the congruence xx ≡ c (mod p) has a solution. Add as many conditions as you want, and combine them using CRT.

We are working modulo p, so the exponents can be handled using Fermat’s Little Theo-
rem. In particular, since z p−1 ≡ 1 (mod p), hence the exponent cycles mod (p − 1). We use
9.3 Thue’s Lemma
this to our advantage. Thue’s lemma is an amazing result in modular arithmetic, and is very useful in constructions
Suppose we set the exponent to be 1, then xx = x = 1. if c = 1 this is enough. However, especially related to squares. Let me first give the statement, and then discuss it further:
if we set the x somehow such that xx ≡ x, then we can set x ≡ c mod p and be done. This
is how we do it: consider the system Lemma 9.3.1 (Thue’s Lemma). Let n > 1 be an √ integer and a be an integer coprime to n.
( Then there exist integers x, y with 0 < |x|, |y| < n so that
x ≡ 1 (mod p − 1)
ay ≡ x (mod n).
x ≡ c (mod p)
x
Basically, we have a ≡ (mod n), where x, y are ”small”. Let’s prove this first. It’s a
y
This has a solution by CRT as gcd(p, p − 1) = 1. Then this works! Here’s a properly written good exercise so be sure to try it yourself first before reading the proof:
proof: √
Proof. Let r = ⌊ n⌋ , which is the unique integer satisfying r2 ≤ n < (r + 1)2 . Now, consider
Proof. Consider the system ( number of the form ay − x with 0 ≤ x, y ≤ r. There are (r + 1)2 > n such numbers, so two
x ≡ 1 (mod p − 1) would be the same by the Pigeonhole Principle. So, for some (x1 , y1 ), (x2 , y2 ), we have
x ≡ c (mod p)
ay1 − x1 ≡ ay2 − x2 ⇐⇒ (y1 − y2 )a ≡ (x1 − x2 ) (mod n).
This has a solution by CRT as gcd(p, p − 1) = 1. We claim that any such x works. Indeed,
we have So, if we set y = y1 − y2 and x = x1 − x2 , we get ay ≡ x (mod n), which is what we need.
xx ≡ xx (mod p−1) ≡ x1 ≡ c (mod p), We just need to show 0 < |x|, |y| < r. The right inequality is clear. However, we could have

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 237 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 238
9. Constructions 9. Constructions

x = 0. If x = 0, then ax ≡ y implies y ≡ 0. This means the pairs (x1 , y1 ) and (x2 , y2 ) were At this point, we can try and answer the more general question: which numbers can be
the same, which is not true. Hence we have 0 < |x|, |y| < r and the show’s over. expressed as sum of squares of two integers? Call a number n good if it can be written as a
sum of squares. Let’s investigate properties of good numbers.
Let’s look at some famous applications

Comment 9.3.1: Consider the circle centered at the origin with radius n, where
9.3.1 Fermat’s Two Square Theorem n ∈ N. Then there is a lattice point, i.e. a point with integer coordinates, on the
Let’s investigate a question raised by Fermat: which primes can be expresses as sums of circumference if n is good. Hence, this question of ours has geometric significance.
squares? Let’s test (the ones left blank indicate no solution to p = x2 + y 2 ) More than this, there’s another useful appearance. A complex number x + iy is called
2 2 2 2 2 2
a Gaussian Integer if x, y ∈ Z. Thus, the problem of asking which integer values can
p x +y p x +y p x +y |z| take for a gaussian integer z is the same as asking which integers are good.
2 12 + 1 2 23 59
3 29 52 + 2 2 61 62 + 52
5 21 + 1 2 31 67
7 37 62 + 1 2 71
11 41 52 + 4 2 73 82 + 32
2 2
13 3 +2 43 79
17 42 + 1 2 47 83
19 53 72 + 2 2 89 82 + 52

At this point, do you observe any pattern? Test your pattern with more values.
If you guessed precisely the primes of the form p ≡ 1 (mod 4) (apart from 2) then you
are correct. This observation contains two things, the first being the fact that no prime
p ≡ 3 (mod 4) can be written as x2 + y 2 . The second fact is that any prime p ≡ 1 (mod 4)
can be written as x2 + y 2 . This is Fermat’s two square theorem2

Theorem 9.3.1 (Fermat’s Two Square Theorem). Let p be an odd prime. Then there exist
integers x, y such that p = x2 + y 2 if and only if p ≡ 1 (mod 4).

Looking at the x2 + y 2 appearing, you should think of Fermat’s Christmas Theorem.


According to it, there exists x such that p | x2 + 1 if and only if p ≡ 1 (mod 4). Interestingly
enough, the condition here is the same too! Clearly, Fermat’s Christmas theorem implies the
first part of our observation above (why?). However, the second part of our observation above Suppose n = x2 + y 2 , and n has one prime factor p ≡ 3 (mod 4). Then p | x2 + y 2 implies
is actually stronger than Fermat’s Christmas Theorem. So we need something stronger. p | x, y by Fermat’s Christmas Theorem (again). So, p2 | n.

The key idea is to use Thue’s Lemma as follows: Suppose we have some a coprime to Now, also note that p | x, y implies x = px∗ , y = py ∗ . So n = p2 ((x∗ )2 + (y ∗ )2 ). Hence, if
√ p3 | n, then p | (x∗ )2 + (y ∗ )2 , again implying p | x∗ , y ∗ . So, p4 | n. In this way, we can show
p. Then we can find 0 < |x|, |y| < p with ay ≡ x (mod p). Then p | x2 − a2 y 2 . So, if we
pick a such that a ≡ −1 (mod p) using Fermat’s Christmas Theorem, then p | x2 + y 2 . The
2 that νp (n) must be even. This is a necessary condition. You can check that this approach
amazing part now is that 0 < x2 + y 2 < 2p (why?). However, the only multiple of p between fails if p ≡ 1 (mod 4), in which case these primes cause no issue. So is νp (n) even for p ≡ 3
0, 2p is p, so we must have p = x2 + y 2 and we are done! By a similar method, you can try (mod 4) primes a sufficient condition?
the following problem
Question 9.3.1. Show that if n = x2 + y 2 is good, then so is 2n by expressing it as the sum
of two squares. In other words we can have any power of 2 and it won’t affect n’s ”goodness”.
Problem 9.3.1. Let n ∈ {−1, −2, −3}. If n is a quadratic residue modulo a prime p, then
there are integers a, b such that p = a2 − nb2 . Suppose m, n are good. Then what about their product mn? If we can show mn will also
2
This is the real ”Fermat’s Christmas Theorem”, not the one we did earlier (in fact this is a generalization be good, then we our condition above would indeed by sufficient (since every prime p ≡ 1
of that) (mod 4) and p = 2 are good).

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 239 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 240
9. Constructions 9. Constructions

So we want to express (a2 + b2 )(c2 + 2


√d ) as a sum of squares. An elegant approach is to a contradiction. So p | b, meaning p | a too. But then p2 | a2 + ab + b2 = p, which is
write z = a + ib, w = c + id where i = −1. Then impossible.
(a2 + b2 )(c2 + d2 ) = |z|2 |w|2 = |zw|2 = (ac − bd)2 + (ad + bc)2 . Now comes the interesting part. Ignore p = 3, since (1, 1) works then. Now note that the
above method can be modified to find an x for which p | x2 + x + 1, when p ≡ 1 (mod 3) (try

Hence, if m, n are good, then so is their product. So now using Fermat’s two square theorem, it). Then, using Thue’s lemma, find a, b such that ax ≡ b (mod p) with 0 < |a|, |b| < p.
we know that every prime p ≡ 1 (mod 4) is good. Further, 2 is clearly good. So any Then
number who prime factors are only 2 or ≡ 1 (mod 4). Further, if n = x2 + y 2 is good, then
p2 n = (px)2 + (py)2 is good. So if we have an even power of a prime ≡ 3 (mod 4), we don’t a2 + ab + b2 ≡ a2 + a(ax) + (ax)2
lose the ”goodness”. Hence, we obtain ≡ a2 (x2 + x + 1) ≡ 0 (mod p).
Lemma 9.3.2. A number n can be expressed as a sum of squares of integers if and only if Now, p | a + ab + b and 0 < a + ab + b < 3p. Hence, a + ab + b2 ∈ {p, 2p}. We are close,
2 2 2 2 2

for any prime p ≡ 3 (mod 4), we have νp (n) is even (possibly 0). but not there. What if a2 + ab + b2 = 2p? Well, then both (a, b) must be even (check this).
Hence, 4 | a2 + ab + b2 = 2p, which is impossible. So this possibility is rejected altogether.
Hence, a2 + ab + b2 = p, and we are through.
Comment 9.3.2 (Some extra information on Brahmagupta’s Identity): The
identity
9.4 Hands-On Constructions
(a2 + b2 )(c2 + d2 ) = (ac + bd)2 + (ad − bc)2 = (ac − bd)2 + (ad + bc)2 .
Upto this point we have talked of methods that are more existence type, in which you know
is called Brahmagupta’s Identity. It can be derived by directly expanding both the the number exists using CRT, or you found a prime using Dirichlet. This section is dedicated
LHS and RHS, however the complex numbers’ approach is an elegant one. to problems where we manually and explicitly construct objects. (Also, just as a note, this
This identity can be used to prove the Cauchy-Schwarz inequality for the 2 variable section would be more about small tricks rather than just a collection of examples.)
case. Also, it can be used to generate quadruples (x, y, z, w) with x2 + y 2 = z 2 + w2 . Solutions of this type to construction problems are often ”magical” and out of the blue,
For instance, this is done by first picking a Pythagorean triplet (k, ℓ, m), and then any and roughly take the form ”take P (x) = 24x3 − 4xy 2 + 1. This works now deal with it”. For
x, y. They are then combined using instance, here is a prime example:
(mx)2 + (my)2 = m2 (x2 + y 2 ) = (k 2 + ℓ2 )(x2 + y 2 ) = (kx − yℓ)2 + (ky + ℓx)2 . Example 9.4.1 (Kvant)
So (mx, my, kx − yℓ, ky + ℓx) is a working quadruple. Is there an infinite set of positive integers such that no matter how we choose some
elements of this set, their sum is not a perfect power?
Let’s look at another amazing application of Thue’s lemma:

Example 9.3.1 Proof. The answer is yes. Consider the set A = {2n · 3n+1 : n ≥ 1}. If we add some elements
from this, it would be of the form 2x 3x+1 y for some y coprime to 6. This clearly isn’t a perfect
Let p be a prime. There exist integers a, b such that p = a2 + ab + b2 if and only if power.
p = 3 or p ≡ 1 (mod 3).
This was not an easy problem by any standard. The proof, on the other hand, is a one
line solution with no back story given, which probably involved pages and pages of rough
Firslty, we prove that if p ≡ 2 (mod 3), then we can’t find such a, b (which is the non- work and trials.
constructive and easy part of the problem). Suppose on the contrary that p = a2 + ab + b2 .
A better way of writing this is 4p = 4(a2 + ab + b2 ) = (2a + b)2 + 3b2 . Then In general, what makes these problems hard is their combinatorial nature, which means
you will have to try a lot of things and there are no fixed approaches you could try. In this
2 2
(2a + b) ≡ −3b (mod p). section, I would try to give some small ideas which could work at times, but more so focus
on examples, including slight motivations for them (because each solution takes a lot of trial
Hence, −3 is a quadratic residue modulo p unless p | b. However, using quadratic reciprocity,
and error and there is no one fixed motivation that can dig a path through). I will try and
    
−3 p −1 p−1 3−1 give some strategies and hopefully you would be able to approach such problems better by
−1 = = · (−1) 2 · 2 = 1, the end of this chapter.
p 3 p

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 241 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 242
9. Constructions 9. Constructions

9.4.1 Restrictions Example 9.4.3 (IMO Shortlist 2014 N4)


The general idea is to experiment with possibilities. At times, you can try to add restrictions Let n > 1 be an integer. Prove that there are infinitely many integers k ≥ 1 such that
and see if they work. For instance, if you want to find odd working n, you only look at which  k
primes values of n work. If you can find a prime that works, you are good to go. Otherwise n
go back a step and try something else. It’s always a leap of faith. The key part is to ask the k
question: ”why did my restriction fail?” If you can answer it, you should be able to mend it.
is odd.
Enough of general talks, let’s look at some examples now. The first one shows how even
the slightest pattern is worth considering: If n is odd, then this isn’t very hard. Just take k = nt for any t. This works.
The interesting part is n even. Suppose n = 2. On experimenting k = 1, 2, 3, . . . , 12,
Example 9.4.2 we find that 12 is the smallest integer for k that works. Now 12 = 22 × 3. This motivates
k = n2 (n + 1). Does it work?
1. Find infinitely many pairs of integers a and b with 1 < a < b, so that ab exactly $ 2 % $ 2 % 2
divides a2 + b2 − 1. nn (n+1) nn (n+1)−2 nn (n+1)−2 − 1
= = ,
n2 (n + 1) n+1 n+1
2. With a and b as above, what are the possible values of

a2 + b2 − 1 which is odd since the numerator and denominator are both odd (here, we used the obser-
2
? vation that nn (n+1)−2 ≡ 1 (mod n + 1)).
ab
So, for each even n, we have working number. How do we get infinitely many? Well, in
2
With no idea on how to start with (2), we start with (1). Naturally, we first set a = 2 to our proof we used the fact that nn (n+1)−2 ≡ 1 (mod n + 1) since n2 (n + 1) − 2 is even. This
get 3b|b2 − 8. It is clear that b = 3 works. remains true if we replace 2 by any even number. So, if we try k = n2t (n + 1) for any t, we
find $ 2t % $ 2t % 2t
At this point, we ask: does every solution of the form (a, a + 1) work? Substitute it, and nn (n+1) nn (n+1)−2t nn (n+1)−2t − 1
= = ,
we get 2t
n (n + 1) n+1 n+1
a2 + b2 − 1 a2 + a2 + 2a + (1 − 1) 2a(a + 1)
E= = = =2 which is still odd. So, for even n, we have found the construction k = n2t (n + 1).
ab a(a + 1) a(a + 1)

That’s how some wishful thinking can come in handy! Example 9.4.4 (APMO 1997)

For the part (2), we guess that every natural number is possible, for which all that Find a number n between 100 and 1997 such that n | 2n + 2.
was needed was to make a (clever) construction. It’s logical to try to extend the above
construction to (a, b) = (a, a + k). If you try this, you would realize it doesn’t work. What This expression should remind you of Example 5.8.2. What the result there tells us is
is it that is not working here, but worked for k = 1? that n cannot be odd. So we only try to find even n. Suppose we restrict it to n = 2p. But
then p | 22p−1 + 1, which fails because of Fermat’s Little Theorem.
After some thought, we realize that it is the 1 that gets canceled by the (annoying) −1!
Suppose we restrict our attention to n = 2pq. So we want pq | 22pq−1 + 1, which means
So we try (a, b) = (a, ka − 1) instead. We then get
−2 is a quadratic residue mod p, q. Further Fermat’s Little Theorem gives us

a2 + (ka − 1)2 − 1 (k 2 + 1)a − 2k a−k pq | 2pq − 1 ⇐⇒ p | 22q−1 − 1 and q | 22p−1 − 1.


E= = =k+
a(ka − 1) ka − 1 ka − 1
We have enough restrictions on our search now, so we manually start to find values. Since we
So we want ka − 1|a − k. The simplest thing that we can do is to make a − k = 0 by setting want −2 to be a quadratic residue, we must have q ≡ {1, 3} (mod 8). Now 3 gives p | 31, so
a = k. That’s it, it works! So we have the working construction (a, b) = (k, k 2 − 1) showing p = 31. But then 31 ≡ 7 (mod 8). So take q = 11. It shows p | 221 − 1 = (27 + 1)(214 − 27 + 1).
every integer k is possible. So if p | 129, then p = 43 since p 6= 3. This works, since 11 | 22(43)−1 − 1 = 285 − 1 (why?).
Hence n = 2 · 11 · 43 works.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 243 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 244
9. Constructions 9. Constructions

9.4.2 Wishful Thinking Then let the sets Si to be Ai ∪ the ith column works, for instance S1 = {2, 3} and S4 =
{17, 19, 3, 5}.
Yes, wishful thinking is very common in all kinds of problems. It is highly involved in any
problem, and mostly used more than once in a challenging one. However, in this section
I present some problems which are short and cute, depicting purely the idea of wishful 9.4.3 Pell’s Equations
thinking. Recall the
a2 − db2 = 1
Example 9.4.5
is the Pell’s equation in (a, b) for a given square-free d. We know that this has infinitely
Prove that for any n, there exist n consecutive composite numbers. many solutions. Occasionally, this fact is useful in constructions. For instance, let’s look at
the following problems:
This shows how prime numbers are so sparsely placed. The key idea is to think factorials,
since they basically contain n consecutive numbers. So, n! + i would have i as a common Example 9.4.7
factor, which would mean this can’t be prime. So if we pick n! + 1, n! + 2, . . . , n! + n, then
we are done... or are we? Well, n! + 1 could be a prime, we can’t guarantee anything here. Find infinitely many triples (a, b, c) of positive integers such that a, b, c are in arithmetic
How do we fix this? We start from n! + 2. However, this gives us n − 1 consecutive numbers. progression and such that ab + 1, bc + 1, and ca + 1 are perfect squares.
To get n consecutive numbers, we pick (n + 1)! + 2, (n + 1)! + 3, . . . , (n + 1)! + (n + 1), and
this works. Firstly, to utilize the AP condition, we make the standard substitution (a, b, c) 7→ (a −
v, a, a + v), an then we have that
Example 9.4.6 (RMM 2015/1)  2
 a − av + 1 = A2
Does there exist an infinite sequence of positive integers a1 , a2 , a3 , . . . such that am a2 + av + 1 = B 2
 2
and an are coprime if and only if |m − n| = 1? a − v2 + 1 = C 2

The key idea here is to think in terms of numbers in terms of its prime factors, since then Now, remember the trick of multiplying a2 + ab + b2 by 4 to complete the square? We apply
we can easily handle the coprime condition as having no common numbers. So, looking at something similar, but a slight variation. Since we have to choose a, we set a = 2u for some
numbers as multisets (chapter 1 anyone?), we want sets A1 , A2 , . . . such that Am ∩ An = φ u. Then some wishful thinking gives
if and only if m, n are consecutive.  2
 4u − 2uv + 1 = (u − v)2 + 3u2 − v 2 + 1
Suppose we set A1 = {2}. Then we can set A2 = {3}. Then A3 must contains A, and so 4u2 + 2uv + 1 = (u + v)2 + 3u2 − v 2 + 1
 2
must be A4 . Hence both contain {2}, and so they can’t be disjoint. So we start with two 4u − v 2 + 1 = u2 + 3u2 − v 2 + 1
elements. In fact, we try and keep 2 ”new” elements, i.e. elements which haven’t occurred
before). where motivated by the 2uv, we wrote the first expression in the form (u − v)2 + · · · and
similarly for the second one, and seeing carefully, we find that the annoying (common)
So set A1 = {2, 3}. Then set A2 = {5, 7}. Write A3 = {2, 11, 13}, and1 A4 = {3, 5, 17, 19}.
component in the first 2 expressions also appears in the last expression! So, we act wishfully
Now for A5 , we choose 2 from A1 , and we are lucky since 2 6∈ A4 . Similarly, we choose 7
and try to set 3u2 − v 2 + 1 = 0. If we can have this for infinitely many (u, v), we are done.
from A2 since 7 6∈ A4 . So we set A5 = {2, 7, 11, 23, 29}. And this idea of ours works, we
However, this is precisely Pell’s equation!
alternatively add elements of A1 into sets after A3 , and similarly alternatively add elements
from A2 into sets beyond A4 . We can express this in the following table: So, our construction is to pick any (u, v) with v 2 − 3u2 = 1, and then set (a, b, c) =
(2u − v, 2u, 2u + v). These can be checked to work manually too.
Ai {2, 3} {5, 7} {11, 13} {17, 19} {23, 29} {31, 37} {41, 43} {47, 53}
From A1 2 3 2 3 2 3 Example 9.4.8
From A2 5 7 5 7 5
From A3 11 13 11 13 ... Show that there exist infinitely many positive integers n such that n2 + 1 divides n!.
From A4 17 19 17
From A5 23 29 Here’s the key idea: if we can select n2 + 1 = dm2 and ensure dm2 | n!, we are done.
From A6 31 The equation we seek is n2 − dm2 = −1, which is negative Pell’s equation. Recall the this

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 245 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 246
9. Constructions 9. Constructions

has infinitely many solutions if we can find one solution. So, we choose d selectively. Since This works, and so we are done.
22 − 5(1)2 = −1, hence d = 5 is good.
Example 9.4.11 (Functions to small polynomials)
Now, if we want 5m2 | n!, we first try to prove n > 5m2 , since then this would be clear.
However, this is not true (why?). We would be done however if two multiples of m √ are less Let h : Fp → Fp be a function. Then there exists a polynomial f with deg f ≤ p − 1
2
than
√ n, since then m | n!, and we can ensure n > 5 (how?). Clearly, m, 2m < 5m = such that h(x) ≡ f (x) (mod p) for all x ∈ Fp .
n2 + 1 < n + 1 implies m, 2m ≤ n, and so our construction works.

Example 9.4.9 The proof is constructive in nature. We define the indicator function εa (x) : Fp → {0, 1}
such that εa (x) = 1 if and only if x ≡ a (mod p), for some a. Then defining f (x) =
Prove that there exists infinitely many positive integers n such that n2 + 1 has two h(0)ε0 (x) + h(1)ε1 (x) + · · · + h(p − 1)εp−1 (x) works.
divisors whose difference is n. So if we find an indicator function which is a polynomial, then we are done. The following
function
Suppose one divisor is a and the other is n + a. The simplest thing for us would be εa (x) = 1 − (x − a)p−1
a(n + a) = n2 + 1, i.e. n2 + 1 = a2 + an. We try to complete the square now, for which we
multiply both the sides by 4. Then this becomes (2a + n)2 − 5n2 = 4. This is Pell’s equation! works.
However, this is not so easy to solve because of the 4 instead of 1. But if we set n = 2k for
some k, then this becomes (a + k)2 − 5k 2 = 1. This is Pell’s equation and hence has infinitely
many solutions, and hence works.

9.4.4 Fermat’s Little Theorem


Fermat’s Little Theorem is very useful in polynomial constructions. There are two particular
uses I would talk about:
1. Every number x ∈ Fp is a root of the polynomial xp − x.
2. xp−1 ≡ 1 (mod p) iff p ∤ x.
The second one can be used to set up ”indicator variables”. For instance, let’s try to prove
the following two results on polynomials in Fp [X] (the names are made-up)

Example 9.4.10 (Degree Reduction)

If f ∈ Z[X] is a polynomial so that deg f > p, where p is a prime, then either

• Every integer is a solution of p | f (x); or

• There exists a monic polynomial g ∈ Z[X] with deg g < p and the roots of
p | g(x) are the same as that of p | f (x).

The key idea is to notice that every integer is a root of xp −x in Fp . So, we find polynomial
q, r ∈ Fp [X] so that f (x) = (xp − x)q(x) + r(x). If r is identically zero (recall it’s coefficient
are in Fp ), then p | f (x) for all x.
Otherwise, we find that r(x) is also zero whenever f (x) is 0 modulo p. This works, except
it might not be monic. So write bxm to be the leading coefficient of r with b 6= 0. Then
consider g ∈ Fp [X] that satisfies
g(x) = b−1 r(x)

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 247 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 248
9. Constructions 9. Constructions

9.5 Example Problems Next, we want p ∤ an + 1. For this, we can pick p − 1 | n so that an ≡ 1 (mod p) by
Fermat’s little theorem. So we have the system:
This section contains many example problems, which serve as a finale. The problems here 
n ≡ z (mod p)
meander through many ideas discussed in this chapter, and hence are quite illustrative. n ≡ 0 (mod p − 1)

Example 9.5.1 We pick such a n. What about p? We want a p such that p ≡ 1 (mod 2b). And of course, we
can choose any of the infinitely many primes satisfying this (by Dirichlet). So we are done.
Let n be a positive integer. Prove that the following two statements are equivalent.
Next, we take a look at a beautiful problem. Even though the statement might seem
1. n is not divisible by 4 weird, it is quite intriguing. The solution is also purely wishful thinking, which makes you
like the problem even more after reading the solution.
2. There exist a, b ∈ Z such that a2 + b2 + 1 is divisible by n.
Example 9.5.3 (USAMTS 2017-18 Round 3 P4)
We first do the easy direction, which is n | a2 + b2 + 1 implies 4 ∤ n. if 4 did divide n,
A positive integer is called uphill if the digits in its decimal representation form an
then we would get a2 + b2 ≡ −1 (mod 4). I will leave it upto you to show this is not possible
increasing sequence from left to right. That is, a number a1 a2 . . . an is uphill if ai ≤ ai+1
(hint: what values can x2 (mod 4) take?).
for all i. For example, 123 and 114 are both uphill. Suppose a polynomial P (x) with
Now comes the interesting part: showing that if 4 ∤ n, then there exist a, b such that rational coefficients takes on an integer value for each uphill positive integer x. Is it
n | a2 + b2 + 1. Looking at the ”a2 + b2 ”, we think of Fermat’s two square theorem. If p ≡ 1 necessarily true that P (x) takes on an integer value for each integer x?
(mod 4) is a prime, then there would exist a, b such that p = a2 + b2 . So we would want
n | p + 1. Now comes the interesting part, since gcd(n, 4) = 1, hence the following system If the answer is no, then we must show that there exists a polynomial P (x) ∈ Q[X],
would have a solution:  either indirectly or explicitly, such that P sends uphill integers to integers, but some non-
p ≡ 1 (mod 4) uphill integers to non-integers. If the answer is yes, then we would need to somehow show
p ≡ −1 (mod n) uphill numbers are strong enough to define P over all integers. It is not too hard to see that
proving the latter would be much harder, so we first try to see if no is a possibility.
The above system would have a solution of the form p ≡ (•) (mod 4n). Such a p would
satisfy both our conditions. However, how do we ensure we can find a prime p satisfying? The first thing we try is to find a good way to think about uphill numbers. After some
Yes, by using Dirichlet’s theorem. thought we can find that 123 = 111 + 11 + 1, 1245 = 1111 + 111 + 11 + 11 + 1. So, if we
define b1 = 1, b2 = 11, b3 = 111, . . . , then each uphill number can be expressed as a sum of
Next we do a problem which can be done by other methods, especially non-constructive bi . A key observation here is that each uphill number is the sum of at most 9 bi because each
(which are more natural solutions). However, a constructive solution is quite fascinating so digit is atmost 9.
it would be a shame to not include it. The key idea is again to be greedy and keep on adding Now, the bi motivate us to think modulo 11. Clearly, bi ≡ 0 (mod 11) if i is even and
as many conditions as needed, and use CRT to combine them. bi ≡ 1 (mod 11) if i is odd. So any uphill number is at most 9 modulo 11. Hence, if x ≡ 10
(mod 11), then x cannot be an uphill integer. So we have found that uphill numbers belong
Example 9.5.2 (All-Russian Mathematics Olympiad 2018 Grade 10/6) to a class of numbers (numbers which are at most 9 mod 11), and this class is much easier
to deal with. So, if we can construct P ∈ Q[X] such that P (x) ∈ Z iff x 6≡ 10 (mod 11) for
Let a and b be given positive integers. Prove that there are infinitely many positive an integer x, then we may celebrate.
integers n such that nb + 1 doesn’t divide an + 1.
We are now done with the hard part, and is just like Example 9.4.11. Note that x10 ≡ 1
(mod 11) iff x 6≡ 0 (mod 11) by Fermat’s Little Theorem. So, the polynomial
We use the simplest idea for construction: find a prime p dividing nb + 1 that doesn’t
divide an + 1. So we want to construct an n such that p | nb + 1, i.e. nb ≡ −1 (mod p). This (x − 10)10 − 1
can be done if we find an n such that ordp (n) = 2b. How do we do this though? P (x) =
11
Here’s the idea: use a primitive root. They are our best tool to control orders, so why works.
p−1
p−1
not. So we can let n ≡ g 2b
and that would work... if 2b
is an integer. So we would want I would like to conclude by sharing a difficult problem given to me by my friend Samuel
2b | p − 1. Add that to the list of conditions we want. Goodman. The solution I present here was also communicated to me by him.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 249 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 250
9. Constructions 9. Constructions

Example 9.5.4 9.6 Practice Problems


Let p be a prime that is 1 modulo 4. Let x denote the number of non-quadratic residues Problem 9.6.1. The integers a and b have the property that for every nonnegative integer

less than or equal to p, modulo p. Then n the number of 2n a + b is the square of an integer. Show that a = 0. Hints: 100
r
√ p+1 Problem 9.6.2 (USAMO 2011/4). Consider the assertion that for each positive integer
|2x − p| ≤ .
2 n
n ≥ 2, the remainder upon dividing 22 by 2n − 1 is a power of 4. Either prove the assertion
or find (with proof) a counterexample. Hints: 221 444 252

Comment 9.5.1: In the chapter of quadratic residues, we showed that the smallest Problem 9.6.3 (USAMO 2017/1). Prove that there are infinitely many distinct pairs

quadratic non-residue is less than p, i.e. we showed x > 0. Here, we are asked to (a, b) of relatively prime integers a > 1 and b > 1 such that ab + ba is divisible by a + b.
prove the much stronger result that Hints: 327 230
r ! r !
1 √ p+1 1 √ p+1 Problem 9.6.4 (IMO 1989/5). Prove that for each positive integer n there exist n con-
p− ≤x≤ p+ .
2 2 2 2 secutive positive integers none of which is an integral power of a prime number. Hints: 181
87 372
The task of showing x > 0 was in itself a good challenge, hence you can expect this
to be a delight too. Problem 9.6.5 (USA TSTST 2018 Problem 4). For an integer n > 0, denote by F(n)
the set of integers m > 0 for which the polynomial p(x) = x2 + mx + n has an integer root.
Here’s the beautiful proof:
1. Let S denote the set of integers n > 0 for which F(n) contains two consecutive integers.
Proof. There are (p − 1)/2 quadratic non-residues. Select any one, say r. Then, using Thue’s Show that S is infinite but X1

lemma, we find 0 < |a|, |b| < p such that ar ≡ b (mod p). Call the pair (a, b) good. Now, ≤ 1.
the key observation is that exactly one of a, b must be a non-quadratic residue, and the other n∈S
n
is a residue.
2. Prove that there are infinitely many positive integers n such that F(n) contains three
Now, p ≡ 1 (mod 4) implies −1 is a quadratic residue. So if (a, b) is a good pair, so are consecutive integers.

(−a, b), (a, −b) and (−a, −b) (note the condition for Thue’s lemma involves |a|, |b| < p not
√ Hints: 394 71 479
just a, b). At least one of these has both its elements less than p. Call such a pair special.
Noting that no two good pairs can be equal (why?), we conclude that there are at least
1 p−1
= p−1 special pairs. Problem 9.6.6 (USAJMO 2016/2). Prove that there exists a positive integer n < 106
4 2 8
√ such that 5n has six consecutive zeros in its decimal representation. Hints: 406 135 105
The final trick is to consider all ordered pairs (k, ℓ) with 0 < k, ℓ < p and exactly one
of k, ℓ is a quadratic residue, the other being a quadratic non-residue. Clearly, there are Problem 9.6.7 (AoPS Mock Olympiad ”SORY” P23 ). Determine whether there exists

x( p − x) such pairs. However, since every special pair belongs to this category, hence an infinite set S of positive integers such that for every real number t ∈ (0, 21 ), we have
√ p−1 |x − my| > ty
x( p − x) ≥ .
8
for every pair of different elements x, y of S and every positive integer m. Hints: 77 18
This can be solved to get the desired bound.
Problem 9.6.8 (RMM 2011/1). Prove that there exist two functions f, g : R → R, such
that f ◦ g is strictly decreasing and g ◦ f is strictly increasing. Hints: 294 240 45 483

Problem 9.6.9. Prove that the equation a2 +b2 = c2 +3 has infinitely many integer solutions
(a, b, c). Hints: 254 330 15
3
See [9]

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 251 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 252
9. Constructions 9. Constructions

Problem 9.6.10 (APMO 2009/4). Prove that for any positive integer k, there exists an Problem 9.6.17 (USA TST 2 2017/3). Prove that there are infinitely many triples
arithmetic sequence (a, b, p) of positive integers with p prime, a < p, and b < p, such that (a + b)p − ap − bp is a
a1 a2 a3 ak multiple of p3 . Hints: 481 482 426 188
, , ,...,
b1 b2 b3 bk
of rational numbers, where ai , bi are relatively prime positive integers for each i = 1, 2, . . . , k Problem 9.6.18 (IMO Shortlist 2013 N3). Prove that there exist infinitely many posi-
such that the positive integers a1 , b1 , a2 , b2 , . . . , ak , bk are all distinct. Hints: 94 227 184 Sol: tive integers n such that the largest prime divisor of n4 + n2 + 1 is equal to the largest prime
pg. 302 divisor of (n + 1)4 + (n + 1)2 + 1. Hints: 248 454 307 438

Problem 9.6.11 (Bulgarian Olympiad). Let f ∈ Z[X] be a non-constant polynomial Problem 9.6.19 (China TST 1 2019/2). Fix a positive integer n ≥ 3. Do there
and let n, k be positive integers. Prove that there exists a positive integer a such that each exist infinitely many sets S of positive integers {a1 , a2 , . . . , an , b1 , b2 , . . . , bn }, such Qnthat
n n
of the numbers f (a), f (a + 1), . . . , f (a + n − 1) has at least k distinct prime divisors. Hints: gcd(a
Qn1 , a2 , . . . , an , b1 , b2 , . . . , bn ) = 1, {ai }i=1 , {bi }i=1 are arithmetic progressions, and i=1 ai
255 299 = i=1 bi ? Hints: 152 63 159 Sol: pg. 304

Problem 9.6.12 (China TST 2006 Day 6/2). Prove that for any given positive integer Problem 9.6.20 (Tuymaada 2004, also INMO 2019/4). Let n and M be positive
n and m, there is always a positive integer k so that 2k − n has at least m different prime integers such that M > nn−1 . Prove that there are n distinct primes p1 , p2 , p3 · · · , pn such
divisors. Hints: 366 416 353 138 that pj divides M + j for all 1 ≤ j ≤ n. Hints: 110 472 462 336 Sol: pg. 305

Problem 9.6.13. Prove that if a number is a quadratic residue modulo all but finitely many Problem 9.6.21 (USA TSTST 2015/5). Let ϕ(n) denote the number of positive integers
primes, then it is a square. Hints: 450 40 Sol: pg. 303 less than n that are relatively prime to n. Prove that there exists a positive integer m for
which the equation ϕ(n) = m has at least 2015 solutions in n. Hints: 119 345 260 75 147 465
Problem 9.6.14 (USAMO 2008/1). Prove that for each positive integer n, there are pair- Sol: pg. 305
wise relatively prime integers k0 , k1 , . . . , kn , all strictly greater than 1, such that k0 k1 . . . kn −1
is the product of two consecutive integers. Hints: 132 262 234 Problem 9.6.22 (APMO 2020/4). Find all polynomials P (x) with integer coefficients
that satisfy the following property:
Problem 9.6.15 (IMO Shortlist 2005 N6). Let a, b be positive integers such that bn + n For any infinite sequence a1 , a2 , . . . of integers in which each integer in Z appears exactly
is a multiple of an + n for all positive integers n. Prove that a = b. Hints: 154 425 316 Sol: pg. once, there exist indices i < j and an integer k such that ai + ai+1 + · · · + aj = P (k). Hints:
303 398 144 48 469 186 Sol: pg. 306

Problem 9.6.16 (EGMO 2018/6). Problem 9.6.23 (USA TSTST 2016/3). Decide whether or not there exists a noncon-
1
stant polynomial Q(x) with integer coefficients with the following property: for every positive
1. Prove that for every real number t such that 0 < t < there exists a positive integer
2 integer n > 2, the numbers
n with the following property: for every set S of n positive integers there exist two
different elements x and y of S, and a non-negative integer m (i.e. m ≥ 0), such that Q(0), Q(1), Q(2), . . . , Q(n − 1)

|x − my| ≤ ty. produce at most 0.499n distinct residues when taken modulo n. Hints: 417 162 485 243 423 323
Sol: pg. 307
1
2. Determine whether for every real number t such that 0 < t < 2
there exists an infinite
set S of positive integers such that

|x − my| > ty

for every pair of different elements x and y of S and every positive integer m (i.e.
m > 0).

Hints: 428 76 439 23 Sol: pg. 304

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 253 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 254
9. Constructions

24. In which set would n be?


25. How many factors does 18 have?
26. Each point in I is uniquely defined by its value mod ai for all i (why?). So, give a complete
characterization of the endpoints of ℓ mod all ai .

Hints 27. Prove f (1) = 0


28. If Sℓ is the sum of powers, then what is S1 , S2 , S3 ?
29. Remove the ceiling by introducing a new variable.
1. Show that f (ab) = f (a) + f (b) + 1 if both a, b are even and f (ab) = f (a) + f (b) otherwise. 30. Consider elements of the form axi + 1 where xi ∈ Sp .
2. Vieta Jump to finish. 31. You should get y p−1 + y ≤ p(y + 1).
3. When x = 1, do some bounding and parity work to show y + z ∈ {503 · 2, 503 · 4}. 32. The process never ends unless a = b. What solutions do you get in this case?
4. You should now get a formula for how many times a segment of length ℓ appears. So find a 33. There is a prime divisor p of 2a − 1 which is ≡ 3 (mod 4).
formula for the desired sum.
34. Take the smallest prime divisor p of n and consider dk−1 dk .
5. Try to force a telescoping sum.
35. If b ≡ z 2 , then show that (2 − z)(2 + z) = 4 − b is a QR. What can you say about 2 − z, 2 + z?
6. Consider algebraic combinations of P (n − 1), P (n), P (n + 1) to get simpler terms.
36. You should get xi is periodic with period c2 − c. Does this cause any issues?
7. You get (a + c − 2b)q = b2 − ac. When does this imply q is rational?
37. Use a variant of Euclid’s construction (for the infinitude of primes).
8. Make n + c = p2 . Combine your results.
38. It does have solutions! Work it out algebraically instead of number theoretic ways (like mod)
9. Write d = 4k + 1 and finish.
39. Prove it for n = 2k , then 2k + 2k−1 . What do you do in general?
10. Show that n = 1.
p √ 40. Pick p to be a quadratic residue modulo all prime divisors of n except one, so it becomes a
11. Prove σ(n) < n d(n) for all pα except one p, where you use the factor of 2. NQR. How do you do this?
12. Why can we shift and scale terms? If we do this to set s1 = t1 = 0 and s2 = 1, then what do 41. Use m − n | f (m) − f (n) repeatedly.
we get?
42. The answer is k = 2.
13. If pM ∤ Q(n), show that M < αt for some constant α. Why does this imply M is bounded by
a constant? 43. Consider (x + a)(x + b)(x + c) and (x − d)(x − e)(x − f ).

14. You get an − bn = p(b − c), . . . In order to pair up (a − b) with (an − bn ), what do you do? 44. If a is a power of 2, then f (n) = ag(n) has a unique solution due to a parity argument.

15. (2ℓ, 2ℓ2 − 2, 2ℓ2 − 1) works. 45. Consider the intervals (2k , 2k+1 ].

16. Use the fact that 2ni − 1 | 2x − 1 and combine all the divisibility relations. 46. Using gcd(x, n + 1) = 1, you should be able to show gcd(m, y − 1) = 1.

17. If b is odd, then 3 is a quadratic residue mod any divisor of 3b − 1. 47. What is the simplest lower bound on the row,column sums?

18. Show ν2 (ai+1 ) < ν2 (ai ). 48. For deg P ≥ 2, the intuition is that P grows very fast and skips a lot of numbers. Based on
this idea, try to construct a sequence {ai } that doesn’t satisfy the problem’s property.
19. Did you know Vieta Jumping is also known as Root Flipping?
49. Your best bet is induction.
20. Suppose a z exists. How do you show uniqueness?
√ √ 50. Let g be a primitive root. What are the others?
21. Now show 4n + 1 < ( n + n + 1)2 < 4n + 3.
51. You would like deg Q = deg P = d. For how many points do you need to define Q? What
22. Show that R(mc ) have the same set of prime divisors. values do you choose?
p1 −1
23. Pick p2 so that p2 ≡ 2 (mod p1 ) and p2 > 2p1 . Continue adding elements like this. 52. Use a3 + b3 + c3 − 3abc = (a + b + c)(a2 + b2 + c2 − ab − bc − ca).

259 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 260
9. Constructions 9. Constructions

53. Use LTE to show r ≤ 2. 79. Write a = x/z and b = y/z so that z n | xn − y n .
i i i
54. Show that any divisor of 23 +1
is either 1 or 3 modulo 8. How do we ensure that 22·3 −23 +1 80. Suppose it is montonic for n ≥ N. Then why is d((n + 1)2 + 1) > d(n2 ) + 2?
gives a new prime of the form 8k + 3?
81. We have xn = (y − 1)m. What is m (mod y − 1)?
n!
55. The numerator is the sum of i . Pair up consecutive odd, even terms.
82. For any c, consider θ(p − p(c)).
56. Let y be a primitive root. What w should you choose to set a ≡ y w ?
83. What is the maximum possible value of gcd(x, k) for any x?
57. The number of pairs (a, b) with a, b coprime and a + b = n is ϕ(n)/2. This is also atmost the
84. What is d (mod 4)?
number of possible values of a = 2k 5ℓ . What bound does this give you?
85. If d is the gcd, then write ani = dki − P. The definition of P gives a polynomial identity in
58. Why do you only need to prove the result for n = pα ?
P n . What relation in d, P does it give?
59. Convert lcm into gcd .
86. Show that n = 2k m2 for some nonnegative integer k and odd natural m.
60. If y p−1 + x | xp−1 + y ≡ (−y)p(p−1) + y. What does LTE give? 
87. You would like terms of the form N !+m = m 1 + N !
m . What’s the obvious scenario in which
y+1
61. Take z = 1. So now you want infinitely many pairs (x, y) ∈ N2 such that x + x+1
y ∈ Z. How
this isn’t a perfect power?
do you do this?
88. You must have ν2 (2q − 2) = ν2 (ordp (5)) ≤ ν2 (p − 1).
62. Use the fact that 1i + 2i + · · · + (p − 1)i ≡ 0 (mod p) for a prime p and 0 ≤ i < p − 1 to show
89. Let f (n) be the number of operations it takes to reach 2. If n = 2k pα1 1 ...pαt t , show that
the formula you had before is 0 modulo a1 .
f (n) = k − 1 + α1 f (p1 ) + ... + αt f (pt ). What do you get for n odd?
63. There is no AP that satisfies a . . . (a + (n − 1)d) = (a + d) . . . (a + nd). So make a slight
90. You should get b + d + a − c | (a + b)(a + d) and a similar result for b + d − a + c.
adjustment to the sequence {ai }.
91. 13(2x + 3y) = 26x + 39y. Why is this useful?
64. Both the polynomials have a root α ∈ (0, 1).
92. If ν2 (nk ) = 0, then when is S odd?
65. Prove that any prime factor p of 2n − 1 must be ±1 (mod 12).
93. Use Fermat’s Little Theorem to reduce the relation 503 | y 3 + z 3 . What do you get?
66. Show that p − 2 6∈ A, p − 4 6∈ A are impossible.
94. Suppose the fractions are (x + 1)/N, (x + 2)/N, . . . . How do you ensure the denominators are
67. Show p | 2(p − 3)! + 1. Assume n ≤ −4 now. distinct?
68. Show that gcd(2 2·3i 3i 3i
− 2 + 1, 2 + 1) is atmost 3. 95. If k 2 ≤ 4n + 1 < (k + 1)2 , between which squares would 4n + 2, 4n + 3 lie?
69. Express u2 , v 2 in terms of d, a, b and then eliminate a. 96. ord(2p+1) (2) ∈ {1, 2, p, 2p}.
70. Can 5 divide any of them? 97. Simplify the congruence to a congruence involving 3, −4, −12.
71. If the elements are a + na , b + nb , c + nc , then using the fact that they are consecutive find c in 98. Take a prime divisor p > 2 of x + y. What can you say about νp (x + y) when n is odd?
terms of x = a − b, y = b − c.
99. Divide by 23 and give a factor of 2 to each term. You should get ak + bk = ±2. What does
72. The idea is to force two equal ai , aj to be equal. Show that we only need to show this over this give?
a finite set of primes.
100. Multiply a term by 4
73. What about the case k = 3?
101. Show that if p < k, then p = 2. Also, when is p not less than k?
74. Take m = p2νp (an )+νp (n)+1 to get a complete characterization of good sequences.
102. What happens if n is odd?
75. Try to prove that ϕ(N ) = ϕ(p1 . . . , pk ) has at least k solutions in n with each prime factor
of N being one of pi . 103. What can you say about p + m − 1?

76. The answer to the second part is yes. Construct is inductively. 104. Show that L = lcm(n + 1, . . . , 2n + 1) divides m − n.
n o
77. This shows xy = 12 for every x > y in S. 105. Find an n such that 5n ≡ 520 (mod 1020 ). Why does this work?
106. 2n + 1 is always odd. What does this mean?
78. Multiply the two relations you got to obtain a divisibility relation involving ac + bd, ab +
cd, ad + bc. 107. Apply the same method of grouping.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 261 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 262
9. Constructions 9. Constructions

108. Use Bézout’s theorem on m, n. 137. Find an algebraic way to convert 2x + 3y to 9x + 5y by adding/subtracting/multiplying
things.
109. Suppose n = ℓ works. Construct an n > ℓ that works too.
138. Combine all the conditions using CRT. (There’s a catch in using CRT. Try to find and fix
110. What can you say about a common divisor of M + i, M + j?
it)
111. If A = {a1 , . . . , ak }, bound a2 − a1 , ak − ak−1 by our previous observations. 139. Suppose 2 ∈ A and write A = {2, x1 , . . . , xi , 4 − x1 , . . . , 4 − xi } and B = {y1 , . . . , yj , 4 −
112. Take (a, b) = (x, −x) and similar values to directly find P (x). yi , . . . , 4 − yj }. Show that you can map each pair (xi , 4 − xi ), (yi , 4 − yi ) to an element of B.
What more can you say about this map?
113. If d | n, then how many times does d occur in f (n)? i
140. If S is the set of p2 , then which elements from S multiply to give f (2k )?
114. To show non-powers of 2 don’t have a unique solution, why does it suffice to show this just
for odd integers? 141. Take p > 2 and show p + 1 divides np + 1. What is the order of n mod p + 1?

115. Use the Pigeonhole Principle to finish. 142. Show that 481 | x, y.

116. For the next two part, the prime factors of which numbers are the easiest to control? 143. If n = 2k , then which primes of the form 4k + 3 can divide 2n − 1?

117. Get 10n S = nk !. So nk | 10. Then if 2, 5 | nk , then gcd(S, 10) = 1. What does this mean? 144. Use Pigeonhole to show all deg P = 1 work.

118. What is ordk (3)? 145. Guess a quadratic polynomial that works.

119. Use induction to show the result for any k, not just 2015. 146. Take x, y so that u = νp (Ax − B) < νp (Ay − B) = v.

120. Write Q(x) = xd R(x) so that x ∤ R(x). We would like to show R is a constant. 147. Using the induction hypothesis, N = npk+1 give k solutions where n satisfies the case k, How
do you get 1 more?
121. Count how many terms in the product are divisible by p, how many by p2 and so on.
√ 148. Pick a q from this set of prime divisors. Take a clever choice for c to get a contradiction.
122. Let k = ⌊ n⌋ . How do you remove the square root?
149. Is n = p possible? What about p2 ? What about pk ?
123. You should get P (x)−x | P 2 (x)−P (x) | · · · | P k (x)−P k−1 (x) | P k+1 (x)−P k (x) = P (x)−x.
150. If x1 6= 2, then show that x2 , x3 ≡ 3 (mod 4) and hence −2 is a quadratic nonresidue mod
124. When x = 2, show |y − z| = 1 and hence show y + z = 503. x3 .
125. The solution is θ(p) = p(c) for a constant c. 151. Give a construction to show Sk is infinite if k has an odd prime factor.
126. Now use mod 11 to find the possible values of a. 152. The key trick here is to consider bi to be a translated sequence of ai , i.e. set b1 = a2 , b2 =
a3 , . . . . Now we need to handle the endpoints carefully so that the product is the same.
127. What is another formula for ζ(n)?
153. In the 1+1/2+· · ·+1/n problem, we considered ν2 . In the 1+1/3+. . . problem we considered
128. x2 y · y 2 z · z 2 x = (xyz)3 . ν3 . However, in our problem, if for some i pi ∈ {2, 3}, then ν2 , ν3 are useless. Which νp should
129. Generate a new quadruple (a∗ , b, c, d). we consider here?

130. 1
+ 1
+ 1
= 1. 154. Instead of directly showing a = b, try to show a ≡ b (mod p) for any prime p.
2 3 6

131. Multiply to get the key equation: an −bn


· bn −cn
· cn −an
= −p3 . 155. Show that d = 2 · 37 or d = 2 · 33 p for a prime p.
a−b b−c c−a
156. Can you ensure infinitely many solutions to a + kb = nt for some t, k?
132. You want to show the existence of x0 for which the polynomial P (x0 ) = x20 +x0 +1 is divisible
by at least n + 1 primes. 157. Assume θ(x) = 0. Why does it suffice to show θ(p) = 0 for all polynomials p ∈ Z[X] with
p(0) = 0?
133. If a = 2k 5ℓ , then a < n. So how many such numbers are possible?
158. You get p | f (0). Why does this cause issues?
134. The key observation is that one of the two divides the other.
159. Take a1 = m, a2 = mb1 , a3 = mb2 , . . . for some m.
135. 58 ≡ 54 (mod 104 ), so the last digits become 0625.
160. Say the first one is x2 and the second is y 2 . Find a, b in terms of x2 , y 2 .
136. Define the sequence of integers bk = (a1 + · · · + ak )/k. The given question is equivalent to
showing what about the sequence hbk i? 161. This time take ν3 .

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 263 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 264
9. Constructions 9. Constructions

162. Show that you only have to show the result for primes. 190. Use f (n) | f (n + kf (n)).
163. Assume 5 6= p 6= q 6= 5. Use p | 5p + 5q . 191. If p | n, then gcd(p, cd + 1) = 1 for all 0 ≤ c ≤ k − 1. If p < k, what does this mean?

164. Show that P ∈ Q[X]. 192. Let m − n = Lγ. Let y be the largest power of 2 in γ. What is the power of 2 in n+i for each
i?
165. Show that n is odd
193. Use a primitive root g.
166. Choose t ∈ Q wisely and set x = π. Use the fact that π is transcendental (i.e. it is not the
root of any polynomial with rational coefficients). 194. Fix i < j. How many values of k satisfy ai + ki ≡ ak + kj (mod p)?
a2 +b2 +a+b 195. If n is even, use the expression for n/2. If n is odd, use the expression for (n + 1)/2.
167. It’s easier to work with k = c − 2 = ab .
168. Show that ab + cd > ac + bd > ad + bc. 196. You get d | 2P n .

169. Suppose x + y = 2ℓ . When can we use LTE? 197. Now suppose gcd(10, s) > 1. Find a way to fix the number you found before such that the
factors of 2, 5 in s don’t cause any issue.
170. Try to count the number of times a segment of ℓ can appear.
198. Try Hermite’s identity. See the next hints for a second solution
171. For any x in A or B, in which set is x(4 − x)?
199. Show (y + 1)n > m > y n if n > 1.
172. Suppose p | P (n). In terms of n, what other P (•) does p divide?
200. Firstly assume gcd(s, 10) = 1. What is the simplest number with sum of digits s?
173. In general, write k = 2s x − 1 for x < k odd. Find an equation showing k is expressible
assuming x is. 201. Show that all ti are integers now! What about si ?

174. You should get ϕ(k) ≥ k − 1. 202. Apply Fermat’s Little Theorem to find a periodicity result for f.

175. To use p − 1 = 2q with q an odd prime, show that ordp (x) ∈ {q, 2q} for x ∈ {3, −4, −12}. 203. Find the answer for 3a , 3a · 5b , 3a · 5b · 7c . Guess a pattern

176. ordp (5) 6= q − 1 but divides 2q − 2. When is this possible? 204. Define A to be the set of a such that ap−1 6≡ 1 (mod p2 ). Can both a, p − a not be in A?

177. Let gcd(a, b) = d, a = dk, b = dℓ. 205. Use f (n) | f (n + kf (n)).

178. What is a νp way of writing what we want to prove? 206. Almost every approach leads to a solution here. For a short one, try to complete the square

179. Find sum of elements and sum of squares of elements. 207. This time, show p2 | ip + (p − i)p .

180. Write p − 1 ≡ −1, p − 2 ≡ −2, and so on. 208. If x 6= 0, you get a bijection from T 7→ T and hence two equal sets.

181. Recall Example 9.4.5. 209. Write m in terms of p in the divisibility relation you obtain.
210. Eliminate n = 2
182. To show the new root is less than x, use estimates such as 4ac > 4a2 = b(c2 − a2 ) − f.
211. Suppose p | a1 . Show that p | ap+1 .
183. Show that we must have 2n − 1 = 3ℓ for some m all of whose prime factors are ≡ 1 (mod 4).
Does the required m exist now? 212. Guess the answer
184. Add one more condition on the primes to ensure (x+i), N have only the prime pi in common. 213. Take cases on p; it’s size determines if d8 = 27 or p or 54.
185. νp (x + y) = min{νp (x), νp (y)} when νp (x) 6= νp (y). 214. Pick p to be the smallest prime factor of n.
186. If you have added till ai , take ai+2 to be the integer of smallest magnitude not yet in the 215. The discriminant must be a square.
sequence (can you think why we do this?). Then choose ai+1 wisely.
216. Show that b | 22n and prove that the only prime divisor of b is 11 with maximum power 1,
187. For the second part, you can try to show ⌊5x⌋ + ⌊5y⌋ ≥ ⌊x⌋ + ⌊y⌋ + ⌊3x + y⌋ + ⌊3y + x⌋ . i.e. b = 11.
Why does this follow from the identity you proved before? 
217. Show ⌊2x⌋ − 2 ⌊x⌋ ≤ 1 so νp 2n n ≤ k, where k is such that pk ≤ 2n < pk+1 . Why is
188. See Example 9.3.1 νp (lcm) ≥ k?
189. Can n be even? 218. Show that at least one number in each pair in {(2, 3), (4, 5), . . . , (p − 3, p − 2)} is in A.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 265 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 266
9. Constructions 9. Constructions

219. Get an alternate expression for g−1 (you might motivate this from the quadratic x2 = x+1). 245. z, z 2 have the same set of prime divisors.
220. In the case c odd, you should show every odd composite number is possible. 246. Show p | f (j 2 /4) = 0 for some j and infinitely many primes p.
221. We basically want 2n mod n to be odd (why?). Go with your gut feeling about the answer 247. Use loose but careful estimates.
(i.e. true or false)
248. Define f (n) = n2 + n + 1. What’s the relation of this with our sequence?
222. Grouping the coefficients (and ignoring them), you get sums of powers. Does this ring a
249. Since si ti ∈ Z, hence the denominator of si divides ti . So what should r be?
bell?
250. Which famous inequality gives 1 + p + · · · + pα ≥ (α + 1)pα/2 ?
223. Show that the given implies k 2 + kℓ + ℓ2 | d. Can you get the bound now?
251. Noting that x > y, just use Vieta Jumping
224. Characterize all n for which d(n) = 2k ?
252. Try n = p2 for some prime p now.
225. Use Problem 3.4.6
253. p − 2k is bounded but there are infinite possibilities for p, k. What does this show?
226. Bound lcm(a, b, c) to show it must equal bc.
254. Set c = b + k. Which k is a good choice?
227. Pick primes pi such that pi | x + i using the Chinese Remainder Theorem.
255. We want a ≡ x1 (mod pi ) for k primes such that pi | P (xi ).
228. Show that 2 is a quadratic nonresidue.
256. A segment is characterized by its endpoints. What congruence relations must the endpoints
229. Consider modulo a suitable number. Guess it by experimenting satisfy for the segment to have length?
230. You can’t have b − a = 1. What about b − a = 2? 257. What is S in terms of a primitive root g?
 p  p
231. Show that ip + (p − i)p + p+1
2 − p−1
2 is divisible by p. Group terms accordingly now. 258. Finally, show the set of primes diving T is finite.

232. Add elements of the equal sets to conclude x = 1. 259. Suppose it’s a a × b table with a ≥ b. What happens if b = 1?

233. Consider the set 0 6∈ Sp formed by the elements of S mod p for some prime p. 260. You let p1 , . . . , pk to be the first k prime numbers, so that any prime factor of pi − 1 is also
from this set. Further, every prime factor of x should be one of pi .
234. Lastly you just need to show that the set of primes dividing elements of P (1), P (2), . . . is
infinite. Does this ring a bell? 261. Write a = pk back in the equation. What happens?

235. Show that composite n don’t work. 262. P (x0 ) ≡ 0 (mod p1 p1 ) ⇐⇒ P (x0 ) ≡ 0 (mod p1 ), P (x0 ) ≡ 0 (mod p2 ).

236. Write n = 2x 3y 5z pα1 1


. . . and define c to be the part inside ⌈•⌉ in the formula for d1 (n). Take 263. Use the result derived to show that if T is the set of quadratic residues except {0, 1}. then
cases for c even, odd. t ∈ T =⇒ (t − 1)x + 1 ∈ T, where x is any xi .

237. If k ≥ 4, then a1 ak = a2 ak−1 = . . . and a similar result for divisors of m. What do you get? 264. What is the relation between bi , bi+1 ?

238. This is very similar to to Problem 6.7.11. 265. What is the most obvious sequence with a set of fixed prime factors?

239. Define the set B to be elements b for which b, 4 − b are both quadratic residues. 266. Explicitly find the orders of 3, −4, −12. What does order = 2q mean?
267. Find an ℓ such that Aℓ − B is divisible by pv+1 .
240. If f is discontinuous, we try to make the intervals where f is increasing or decreasing. Let g
be a ”jump” function which helps to change intervals. 268. Now that we know f is multiplicative, what do we do?
241. Make a table (or graph) with each row corresponding to a value of k. Join two elements by 269. Now you just need the sum of quadratic residues mod p (why?)
a line in a row if they are congruent for that k. How many lines are there in the table?
270. Can m be a perfect power?
242. The formula would be the sum of a polynomial p(x) as x varies over all possible values of ℓ
271. Show that if pM | T and pm | Q(n), then M is bounded.
(which you found before). What is the degree of p?
272. For any t ∈ Q, what’s the leading term and coefficient of P (x) + P (t − x)?
243. Choose deg Q = 4 and something of the form (kx2 + ℓ)2 , so that Q(a) ≡ Q(b) gives a ≡ −b
or ka2 + ℓ ≡ −kb2 − ℓ. 273. Can you bound f (2p)?
244. Write ab − 1 = (ad )b/d − 1 and use LTE now. 274. Show nk = nk−1 + 1

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 267 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 268
9. Constructions 9. Constructions

2018
275. Show that 4k + 1 is expressible. To show 4k + 3 is expressible, you 8k + 3 is expressible. For 303. Use LTE to show 5k | a2018 + 1 is not possible.
8k + 7, again make two cases.
304. Introduce k = |m − n|.
276. For the second part, think 11(4a + 5b − 3c).
305. Instead of the sum of d, look at the sum of n/d.
277. How many times can k appear in the three gcds? What about a smaller divisor of k?
306. Show gcd(2n + 4, 14n + 3) = 1.
278. Show that if k is odd, then 2k + · · · + 1 has at least one prime divisor p ≡ 3 (mod 4)
307. Can ||f (i)|| be strictly decreasing?
279. Write d = gcd(xy + 1, xy + x + 2) = gcd(x + 1, y − 1) so that xy + 1 = du2 , xy + x + 2 = dv 2 .
308. Use f (a + d) ≡ f (a) (mod d).
280. Suppose 5k is the smallest of all, and attained for a2018 + a2 . What does this assumption
1 309. You get αm + αm+1 = α(1 + α) = αn . What bound on n does this give you?
give?
310. The identity should have a difference of squares.
281. If a > b, you should get p | a but not b.
311. Show k ≤ 2 and deal with these cases.
282. Use induction
p−1 312. Suppose n has two prime factors and write n = pα m, with p the smallest prime factor of n.
283. You can assume 0 ≤ x, y ≤ 2 . How many solutions does x2 + y 2 ≡ 1 have?
313. Consider a change of variables to A, B ∈ Q+ so that the problem becomes about the terms
ip +(p−i)p
284. In the remaining expression, what is p2
(mod p)? An − B which are ALL divisible by p.
285. Show p | P (2q ) for all primes p. What does this mean? 314. Let p < q be the two smallest primes factors of n. Where could p, q be? What about n n
p, q?
286. Show d(n2 + 1) ≤ n for even n to conclude. 315. Let k be such that 2k ≤ n < 2k+1 . Keep pairing up consecutive terms to get ν2 of the
287. This can be seen as a quadratic in a. One solution is (2, 2, 2, 2). numerator is ν2 (n!/2k ).

288. Phrase it in terms of modular things. 316. Set n ≡ 0 (mod p − 1) and another congruence. Then use CRT to combine them.

289. Use induction to finish. 317. To do this, first construct a k such that νp (Ak − 1) = v. Then consider Akr+y − B, and select
r decisively.
290. Take p to be the smallest prime factor of n.
318. Consider ν2 .
291. Pick n = 2p such that 2p > ℓ. In which cases does 2p not work? How do you handle these
cases? 319. Prove f (x) = c(x − 1)r . How do you bound r

292. How would you define the polynomial Q(n)? What could be it’s degree? 320. If p | q − 1, try to find a suitable a such that x−1 + 1 ≡ a (mod p) gives the result.

293. Show that f (22a−2 ) = a22a−2 . 321. Write f (x) = x + c. Use Wilson’s theorem to eliminate some values of c.
x
322. Show that x, 22 + 1 are coprime.
294. Suppose we add a restriction: f is continuous. What happens?
 323. You get the bound for large enough primes p. How do you ”ignore” the small primes?
295. Pick a prime p. What’s the simplest upper bound on νp 2nn ?
324. Use some estimates on ϕ(n) to show this can’t hold for infinitely many n.
296. Vieta Jumping! But simplify the numerator first
a b 325. Introduce the fractional part!
297. When is b, a is terminating for a pair of coprime integers a, b?
326. a1 + a2 + · · · + ak ≡ a2 + · · · + ak , and the left side is k times a square while the right is k − 1
298. Suppose p | a + b. When can LTE work?
times a square. Is this possible for all k?
299. For f (a + 1), f (a + 2), . . . set up similar systems.
327. You want ab ≡ (−1)a aa (mod a+b). So set a to be odd. You then want ab−a ≡ 1 (mod a+b).
300. What’s the best way to deal with the case p = 3?
328. How many powers of 2 can you find in n + 1, n + 2, . . . , 2n + 1?
301. gcd(ai + j, aj + i) = gcd(ai + i + aj + j, aj + i). Can you force p ∤ (ai + i) + (aj + j) for all
329. Multiply 5 to the left and you get 5n .
i, j by taking a suitable sequence?
p 2 330. Pick k = 1.
302. By Heron’s formula, A = x 3(x2 − 1). You want x 3−1 to be a square. Does this remind you
of something? 331. If q | (x + 1)p − xp , what is ordq (x−1 + 1)?

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 269 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 270
9. Constructions 9. Constructions

332. For n = 3, assume a + b + c = 1. Then normalize by writing a = x/(x + y + z), . . . 361. If k = 2ℓ , then what can you say about ordp (a · b−1 ) where p is a prime?
l Q m
333. To make use of the condition, expand (wxi + 1)n (mod p) over all xi . Q
362. If n = 3x pα1 1 . . . , then you should get d1 (n) = pi ≡1 (αi + 1) 12 pj ≡2 (αj + 1) , where the
334. It’s a cyclic expression, so assume an ordering on νp (a), νp (b), νp (c). indices are mod 3.

335. What happens now if p | n? 363. Show that x ∈ {1, 2} using the fact that x | 2012 = 22 · 503.

336. Show that all the new terms are pairwise coprime. 364. Show that x1 , . . . , xk must be prime.

337. First show that νp (an ) − νp (a1 ) ≤ Hn−1 νp (C), where Hn = 1 + 1/2 + · · · + 1/n. 365. To show a z exists, try an approach like in Example 2.12.1.

338. We don’t have a good formula for Sℓ if ℓ ≥ 4. How do we prove the formulas for S2 , S3 ? 366. Fix n and induct on m.
Maybe try and use those methods 367. Pick r to be the gcd of all ti .
339. Use induction 368. If 2k − 1 | 2n − 1 with k odd, then it has a prime factor p ≡ 3 (mod 4). What next?
340. What is the value of each summand? 369. Write x + y = 3k, x − y = b.
341. Can deg f be greater than 1? 370. Create a polynomial to find expressions of the form a + b + c, ab + bc + ca.
342. Instead of proving your expression is ≥ 0, prove that it is > −1. This gives you more freedom 371. Show that p | ak+1 for our choice of k.
on estimates.
372. Consider (2n)! + k.
343. Assume a ≥ b ≥ c and show a | bc.
373. What’s the best way to deal with the case p | x?
344. Show in the original equation that each 0 < n − m < q gives a valid (n, m) pair.
374. Try Vieta Jumping
345. Suppose you have a set of prime factors S = {p1 , . . . , pk }. To keep ϕ(x) = ϕ(n) for a fixed n
375. What are the possible lengths of any segment? It would obviously be an integer, but can you
and many x, you want each prime factor of ϕ(x) to be from S. How do you ensure this?
explicitly say which values it can take?
346. The cubic factorizes!
376. Write (n + 1)ℓ − 1 as the telescoping sum of (i + 1)ℓ − iℓ as i goes from i to n. (this is how
347. If p = 2 divides z, use LTE to show ν2 (n) is bounded. formulas for S2 , S3 are derived)
348. Can you find a m such that νp (m) > νp (n) and νp (am ) > νp (an ). 377. Write p + m − 1 = pα and use pα + m − 1 | n.
349. You have akϕ(b)+1 ≡ a (mod b). Are a, b coprime? 378. You should get 3n−1 + 5n−1 | 2 · 3n−1 . Why are we done?
350. Group terms in the most natural way possible. 379. Work mod some special number.
351. Write n in binary and do this. 380. mod 10.
352. If k is a prime, then why do you need to show 3 is a quadratic nonresidue? 381. The right side is not multiplicative (why?). So what do we do?
353. To attach a new prime dividing 2ℓ − n, we would want gcd(p, x) = 1. 382. Show that f = ϕ ∗ id.

354. Observe that g(g − 2) ≡ −(g − 1) (mod p). 383. Consider n = pq for two distinct odd primes p, q.

355. Ensure all the 3 conditions of LTE 384. Show that that if R(mc ), R(m) have the same prime divisors, then so do R(mc−1 ) and R(m).

356. Let s = max νp (aj ), and say s = νp (aw ). What can be the νp of the rest of the terms? 385. Why must we have p = 2?
j
386. Derive a formula for d1 (n).
357. This is similar to Wolstenholme’s theorem. Try Gaussian pairing.
(n+1)p −1
387. Pick any prime p ∈ {2, . . . , 100}. Then what does n give by the telescoping method?
358. Evaluate the small cases by hand. For the larger ones, consider mod 8.
388. You get 2k+1 m2 + 1 = (2k + · · · + 1)σ(m). What happens if k is odd?
359. Look at tuples of the form (νp1 (an ), . . . , νpk (an )), so that we have to force two tuples to be
equal (why?). Count the number of such tuples and use the bound on νp (an ) from before. 389. Guess the answer
360. In p | P (n + pk), pick a k such that p − 1 | n + k. What do you get? 390. What does (i, j) = (2m, 2n) give?

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 271 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 272
9. Constructions 9. Constructions

391. Get a quadratic in x. 421. Take m = 2n − 1.


392. What can you add/subtract from n2 + km2 to get k + 1? 422. Use n − i | Q(n) − Q(i) = Q(n) − qi for 0 ≤ i ≤ d.
393. Use the result from Problem 8.4.2. 423. Take Q(x) = (2x2 − 1)2 and carefully count the number of repeated residues.
394. Characterize all n such F(n) has two consecutive elements 424. Pick a prime factor p common to d, P. What does it give you?
395. Product of 4x − a2 works. 425. For a given prime p, smartly pick a n such that p | an + n and p | bn − an =⇒ p | b − a.
396. Just do some bounding now. 426. How does this give p3 | f (p)?
397. Consider a number with all digits 1. Write n = 10x1 + ··· + 10xs . What can you choose the 427. Show that there is a row with all elements atmost n/b.
xi to be such that this becomes divisible by s?
428. If S = {a1 , . . . , an }, then max ai ≥ n − 1 + min aj .
398. Guess the answer.
429. Make the same substitution as in Problem 4.9.19, i.e. u = (X + Y )/2, v = (X − Y )/2.
399. What’s the νp condition for a rational number to be an integer?
430. Use induction.
j k j k
400. How does this relate to polynomials? 431. The left side should become the sum of a (a+1)2
− a2
.
p p
401. If p | (b + c), then p | bc. What does this give?
432. Take (n, 2n), (2n, 3n), (3n, n) to get n | 2a2n .
402. Use induction.
433. Show that νp (aj ) < s for all j 6= w.
403. m + 1 | mm + 1 if m is odd. Which odd number should you choose?
434. When can you use LTE?
404. Rearrange the equation and make the key substitution: x = a + c, y = c − a, where c2 =
a2 + ⌈4a2 /b⌉. 435. Look at 3α for some α.

405. Consider a prime p dividing f (k 2 ) with 0 < k < p/2. Then p − 2k ≤ A. What does this 436. Now p | 2(p − 3)! − 2(p − n)! holds for all large primes and a fixed n ≤ −4. Why is this not
mean? possible?
437. This basically means cd + 1 is coprime to n for all 0 ≤ c ≤ k − 1. What is d in terms of n, k?
406. Compute small powers and observe how consecutive zeroes occur.
407. How do you deal with 1/i (mod p)?
438. Use f (n2 ) = f (n)f (n − 1) to show it can’t be strictly increasing either.
408. Let lcm(n1 , . . . , nk ) = x. What do you get? x−1
439. You want 1 − t > x mod y
y > t. A hint to do this is to consider f (x) = x
2
, which gets closer
409. What formula did we find in Example 3.5.9?
to 12 as x increases.
410. Why do you need to show F = G ∗ 1?
440. What’s the solution of the Pell’s equation x2 − 3y 2 = 1.
411. If ab = 7 · 2k , then a = 7 · 2t , b = 2k−t or a = 2t , b = 7 · 2k−t . Why does this help here?    
441. In this case show that n2jk = n5jk for all j. Why is this not possible?
412. Gaussian pairing.
442. What do you do when you have 2 equal sets?
413. How do we handle the condition that P, Q are coprime?
443. If p > 2 divides z, find an inequality using LTE which can’t hold for infinitely many n
414. Show that both the sides are multiplicative
444. Consider the restriction: n is a prime. What happens here?
415. Try the same method as the n | 2n − 1 problem.
445. You should get b2 = (k − 2)2 (4k + 1) so 4k + 1 is an odd square. Use this to get a complete
416. If x = 2k − n, then find a class of ℓ for which x | 2ℓ − n. family of solutions.
√ 
417. The answer is yes. 446. For a fixed constant a, how many j satisfy a = jp ?

418. Why can you assume gcd(a1 , . . . , an ) = 1? 447. Use an argument similar to n | 2n − 1 =⇒ n = 1 to show p | f (p + 1) for all large primes

419. How do you prove p | 1 + 2 + · · · + p? 448. If p is a prime, what is f (p)?


Q Qβ(p)−1 i
420. Prove f (n) | nf (n) . 449. You have a sequence β such that n = p i=0 p2 . What constraint do the β satisfy?

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 273 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 274
9. Constructions 9. Constructions

450. We would like to construct a prime p such that n is a quadratic nonresidue mod p. If n = pi , 479. You should get c = (•)/(y − x). What’s the simplest way of making this an integer?
then we can easily do this using quadratic reciprocity and Dirichlet’s theorem. What about
480. Why is this sufficient to imply that only finitely many such primes exist?
the general case?
481. Factorize f (t) = (a + b)t − at − bt for t = 3, 5, 7.
451. Show that 2Q(n) −1 | 3T −1 where T = gcd(P (n+zQ(n)). We just need to show T is bounded
by a constant now (why?) 482. Show that (a2 + ab + b2 )2 | f (p) for certain primes p.
452. Pick a prime divisor p of n. What do you know about ordp (2)? Is there a special p you should 483. Take f (x) = x, −x alternatively in these intervals, and let g(x) = 2f (x).
pick?
484. Write (6, 2, 2, 2) as (2, 6, 2, 2). Then you have a new quadratic, new root!
453. Show n ≤ 4 using ”vieta Flipping”. Do all n ∈ {1, 2, 3, 4} work?
485. We want to force as many terms to be equal as possible. x ≡ −y =⇒ x2 ≡ y 2 hence
454. Define ||x|| to be the largest prime factor of x. If the problem statement is not true, then Q(x) = x2 removes half the pairs, but we need to remove more and so need Q(a) = Q(b) to
show that ||f (i)|| must be monotone eventually. give more constraints. What degree should we choose?
Q i +1
455. Find the answer for 2a , 2a · 3b , 2a · 3b · 5c . 486. We want k = 2α αi +1 . Here, show all αi are even and guess the answer.
456. Show that νp (an ) ≤ A log n for some fixed constant A. 487. Suppose you have a set of k terms from the sequence that are all pairwise relatively prime.
457. If m satisfies the property, then show that so does mq for any prime q. Can you construct a new term?

458. If a2m is odd, show a2t+1 is odd for all t. 488. Let p be the smallest prime not in the list.

459. Make n + c a prime p.


460. Use some smart bounding to show Q(n) = qn for all n.
461. Use Theorem 3.3.1.
462. Divide (M + i) by gcd(M + i, (n − 1)!). What happens?
463. Prove the result for n = pk . What about the general case?
464. Show m < 2n and finish.
465. Let pk+1 − 1 = pα1 1 . . . pαk k . Then consider N = pα1 1 +1 . . . pαk k +1 .
466. You should get −15 is a quadratic residue mod 481. Is this possible?
467. p − 1 ∈ A. So p − 2 6∈ A. So p − 3 ∈ A. So p − 4 6∈ A. Is this possible?
468. use b + d + a − c divides ac + bd to get a more useful result.
469. Add elements one by one.
470. Let q be a prime divisor of x. Then ordq (p − 1) | 2x, q − 1. Is there a special choice for q?
471. Take x1 x2 . . . xn − 1 mod 2y+1 .
472. Try to alter the terms so that you remove almost all factors less than n − 1.
473. If ν5 (nk ) = 0, then S is odd. So?
474. This gives q | p(p − 2) if q is the smallest prime factor of x.
475. You want x2 + y 2 ≡ 1 (mod p) with 1 < x2 + y 2 < (p − 2)p + 1.
476. What can you deduce about ordp (5), ordq (5)?
477. For k ≤ 2, what can be the prime factorization of n?
478. What is ai (mod 5) over all i?

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 275 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 276
9. Constructions

Solution 1.12.15 (INMO 2019/3)


Let k = |m − n|. We have to then prove

gcd(m, k) + gcd(m + 1, k) + gcd(m + 2, k) ≤ 2k + 1.

Solutions to Selected Problems Clearly k = 1 works, and k = 2 works if m is even. Suppose k > 2 now.
Observe that k can appear at most once in the above three gcds. So,
k k
gcd(m, k) + gcd(m + 1, k) + gcd(m + 2, k) ≤ k + + < 2k + 1.
2 2
Solution 1.4.2
Hence, the only equality cases are when m, n are consecutive, or differ by 2 and both are
Firstly, since p, q are odd, hence p + q is even, so 2 | p + q. Thus, (p + q)/2 is an integer. To even.
show p + q has at least three prime factors, we must show (p + q)/2 is not a prime. But

p+q
Solution 1.12.16 (USAMO 2007/1)
p< < q. a1 +a2 +···+ak
2 Define bk = k
. We know bk ∈ N for all k by the hypothesis. They key observation
is
By hypothesis, p, q are consecutive primes. Hence (p+q)/2, an integer between them, cannot a1 + a2 + · · · + ai+1 a1 + a2 + · · · + ai + i
bi+1 = < = bi + 1.
be a prime!  i+1 i
as 0 ≤ ai+1 ≤ i. So, bi+1 ≤ bi for all i, and hence {bi } is a non-increasing sequence. However,
Comment: Looking at examples for the first few primes, it might be tempting to it is always positive and hence lower bounded, so it will eventually become constant. This
show something like one of 3 or 5 always divides p + q. However, that approach fails. is the key idea.
If thought logically, showing something like 3 | p + q almost always happens would be
So, eventually a1 + a2 + · · · + an forms an arithmetic progression for large enough n ≥ i,
saying that their is a nice pattern that consecutive primes follow. However, we know
and hence the differences ai+1 , ai+2 , . . . are all equal. This is what we wanted to prove. 
how random they are, so our intuition should be enough to tell us that this approach
cannot fail.
Solution 1.12.17 (USAMO 2007/5)
The proof goes by induction on n, the base case n = 1 being clear. Now we have the following
identity that can be proven by direct expansion:
Solution 1.12.8 (Russia 2001 Grade 11 Day 2/2)
x7 + 1
Let d = gcd(a, b) and write a = dk, b = dℓ, with gcd(k, ℓ) = 1. Then = (x + 1)6 − 7x(x2 + x + 1)2
x+1
n
d2 (k 2 + kℓ + ℓ2 ) | d3 kℓ(k + ℓ) ⇔ k 2 + kℓ + ℓ2 | dkℓ(k + ℓ). So put x = 77 and note that the right side is a difference of squares, hence not a prime.
n+1 n
Thus, 77 has at least 2 primes factors more than 77 +1, and this completed the induction.
However, gcd(k, k 2 + kℓ + ℓ2 ) = gcd(ℓ, k 2 + kℓ + ℓ2 ) = 1, and even gcd(k + ℓ, k 2 + kℓ + ℓ2 ) =
gcd(k + ℓ, kℓ) = 1. Thus, k 2 + kℓ + ℓ2 | d. Hence d ≥ k 2 + kℓ + ℓ2 . Comment 9.6.1: This was inspired by the following identity:
Thus, (a + b)7 − a7 − b7 = 7ab(a + b)(a2 + ab + b2 )2 .
|a − b|3 = d2 · d · |k − ℓ|3 Some similar useful identities are
≥ d2 · (k 2 + kℓ + ℓ2 ) · 13
= a2 + ab + b2 > ab. (a + b)3 − a3 − b3 = 3ab
(a + b)5 − a5 − b5 = 5ab(a + b)(a2 + ab + b2 ).

3
Hence, |a − b| > ab, which is the desired bound. 

277 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 278
9. Constructions 9. Constructions

Solution 1.12.18 (ELMO 2017/1)


Comment: Expand and simplify the given condition to
As the power of each term in both RHS and LHS is n, we can assume gcd(a1 , a2 , . . . , an ) =
1 so we need to show a2 − ac + c2 = b2 + bd + d2 .
gcd(an1 + P, an2 + P, . . . , ann + P ) ≤ 2.
So, by the cosine law, there exists a quadrilateral ABCD with AB = a, BC = c, CD =
Let d = gcd(an1 + P, an2 + P, . . . , ann + P ), assume d 6= 1, 2 otherwise we are done. Consider b, DA = d such that ∠ABC = 60◦ and ∠CDA = 120◦ . Since 60◦ + 120◦ = 180◦ , hence
a p, a prime factor of d. This means p | ani + P for all i. If for some i, p | ai , then ABCD is cyclic. Now, using Ptolemy’s theorem, there exists an expression for AC 2
p | P , so p | an1 , an2 , . . . ann or p | a1 , a2 , . . . , an which is false as gcd(a1 , . . . , an ) = 1. This just in terms of a, b, c, d. If you remember it, great! otherwise we can derive it now.
means gcd(d, P ) = 1. Finally we have, d | ani + P , so let ani = dki − P for some integer ki . Write α = 60◦ . Then
Multiplying this over all i, we get a2 + c2 − b2 − d2
a2 + c2 − 2ac cos α = b2 + d2 + 2bd cos α =⇒ 2 cos α = .
ac + bd
P n = an1 an2 . . . ann = (dk1 − P )(dk2 − P ) . . . (dkn − P ).
Hence,
If we multiply out each term on RHS, except (−1)n P n = −P n (as n is odd), all terms are a2 + c2 − b2 − d2 (ab + cd)(ad + bc)
AC 2 = a2 + c2 − 2ac · = .
divisible by d and on LHS P n remains. Therefore d | 2P n but gcd(d, P ) = 1, so d | 2 and we ac + bd ac + bd
are done.  So ac + bd | (ab + cd)(ad + bc), and this is a new proof of the claim!
In fact, we can remove the geometry from the above problem completely by working
Solution 1.12.19 (IMO 2001/6) 1 = 2 · 12 instead of 2 cos αa So,
The key claim is the following: a2 + c2 − ac = b2 + d2 + bd =⇒ a2 + c2 − b2 − d2 = ac + bd.

Claim. We have ac + bd | (ab + cd)(ad + bc). So,

There are many ways to prove this. But before that, let’s see how this finishes the (ac + bd)(a2 + c2 − ac) = (ac + bd)(a2 + c2 ) − ac(a2 + c2 − b2 − d2 ) = (ab + cd)(ad + bc).
problem. Now, a > b > c > d implies ab + cd > ac + bd > ad + bc (by the rearrangement
inequality, or simply by expanding (a − d)(b − c) > 0 and (a − b)(c − d) > 0). So, if ab + cd This can be thought of as a ”third proof” of the claim. It would generally be written
is a prime, then ab + cd would be coprime to ac + bd. Hence ac + bd | ad + bc which implies as a ”clever algebraic manipulation”, however a geometric interpretation makes it very
ac + bd ≤ ad + bc, contradicting what we found earlier. Hence we are done.  easy to discover.

Now let’s see how to prove the claim. The proof we give is just clever algebraic manipu-
a
Constants are harder to note since they are just sitting there. Variables, on the other hand, are
much easier to work with since you can see them in action. This is one of the weird moments when
lations:
a general version is easier to deal with than the normal one.

Proof. Firstly,

b + d + a − c | (ac + bd) + a(b + d + a − c) = (a + b)(a + d). Solution 2.14.11 (Sierpiński)


Similarly, Let n = 2α 5β γ, where γ is coprime to 10. Consider the number
b + d − a + c | (ac + bd) + c(b + d − a + c) = (c + b)(c + d).
n = 10α+β (10sϕ(γ) + · · · + 10ϕ(γ) ).
So,
Clearly, the sum of digits of n is s. Further, 2α 5β | n and by Euler’s Theorem,
(b + d + a − c)(b + d − a + c) | (a + b)(a + d)(c + b)(c + d)
10sϕ(γ) + · · · + 10ϕ(γ) ≡ 1| + 1 +{z· · · + 1} = s ≡ 0 (mod γ).
⇔ ac + bd | ((ac + bd) + (ad + bc)) ((ac + bd) + (ab + dc)) s

This gives ac + bd | (ab + cd)(ad + bc), which is what was desired. Hence, s | n and our construction works.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 279 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 280
9. Constructions 9. Constructions


Solution 2.14.13 (USAMO 2018/4) So now n+i is odd if and only if n + i = 2w . Also, if the power of 2 in γ is y, then
Lγ Lγ
2 < n+i < 2k and so k ≥ y + 1. So, n+i
y
≡ 0 (mod 2y+1 ) unless n + i = 2w , in which case
The key observation is the following:
this remainder is 2z . Hence
Claim. For any i < j, there is exactly one value of k for which ai + ki ≡ aj + kj (mod p).     
Lγ Lγ Lγ
0≡ +1 + 1 ... +1 −1
Proof. Just observe that the two being congruent is the same as k ≡ (ai − aj ) · (j − i)−1 n+1 n+2 2n + 1
(mod p), which is a unique number only depending on i, j. ≡ 1 · 1 . . . 1 · (2y + 1) − 1
≡ 2y (mod 2y+1 )
Now, make a table whose kth row is elements of the form ai + ki. For each row, join two
elements by a line if they are congruent modulo p. 5 Now, a pair (ai , aj ) for some i, j is which is a contradiction. 
connected only in one row in the entire table by the claim. Hence, the total number of lines
in the table is the number of pairs, which is p2 .
 Solution 2.14.17 (ELMO 2019/5)
Further, there are p rows. Hence one rows contains at most p1 p2 = 12 (p − 1) lines. Hence,
They key claim is the following:
at most (p − 1)/2 pairs are congruent, meaning that we have at least 21 (p + 1) remainders,
as desired.  Claim. Let p be a prime. Let Sp denote the the set S whose elements are reduced modulo p.
Then if 0 6∈ Sp , then |Sp | = 1.
Solution 2.14.15 (Iran 2017 Round 3/1) Proof. Assume Sp = {x1 , . . . , xn } and 0 6∈ Sp , so that n < p. Pick any a ∈ Sp , and observe
that all elements of {ax1 + 1, . . . , axn + 1} are distinct modulo p. However, all these are in
The idea is to use Bézout’s theorem. We find integers a, b such that am + bn = 1. So
S, and this set has n elements too. Hence, we must have
n
x ≡ xam+bn = xam xbn ≡ y a xb (mod p).
Sp = {ax1 + 1, ax2 + 1, . . . , axn + 1}.
Similarly, m Summing up the elements yields
y ≡ y am+bn = y am y bn ≡ y a xb (mod p).
x1 + · · · + xn ≡ a(x1 + · · · + xn ) + n ⇔ (a − 1)(x1 + · · · + xn ) ≡ −n (mod p).
Hence z = y a xb works.
To prove uniqueness, assume on the contrary that z1 , z2 exist that satisfy the given Since n < p, hence p ∤ n meaning that x1 + · · · + xn 6≡ 0 (mod p). Now the above holds for
conditions. So z1n ≡ z1n ≡ a (mod p) and z1m ≡ z2m ≡ b (mod p). So, if z = z1 · z2−1 , then all a ∈ Sp , which is impossible since a ≡ −n · (x1 + · · · + xn )−1 (mod p) is unique. Hence,
z m ≡ 1 ≡ z n (mod p). However, by Example 2.12.1, we find z ≡ z gcd(m,n) ≡ 1 (mod p), we must have n = 1, as desired.
giving z1 ≡ z2 , a contradiction. 
So if p divides no element of S, then all elements in S are congruent to s, where s is some
element of S. However, s2 + 1 ∈ S implies s2 + 1 ≡ s (mod p), i.e. p | s2 − s + 1.
Solution 2.14.16 (IMO Shortlist 2015 N3) Since s can be fixed (choose any one element of S), hence s2 − s + 1 is finite implying
Observe that xk − 1 = m−n . Hence, m − n is divisible by all n + 1, n + 2, . . . , 2n + 1, hence it has a finite number of prime factors. Hence, the number of primes p not dividing any
n+k
divisible by their LCM. Write lcm(n + 1, n + 2, . . . , 2n + 1) = L and m − n = Lγ. Now, element of S is finite too, and we are done.
assume the result is not true. So there exists k ∈ N such that
     Solution 3.7.12 (IMO Shortlist 2016 C2)
Lγ Lγ Lγ
+1 + 1 ... + 1 − 1 = 2k .
n+1 n+2 2n + 1 The answer is n = 1. Suppose there are a rows and b columns. If b = 1, then clearly we must
have n = 1 so say a ≥ b > 1 now. The key idea is that the common row, column sums are
Now the key observation is that there is exactly one power of 2 in n + 1, n + 2, . . . , 2n + 1 > n because n would be an element in some cell.
since 2n + 1 = 2(n + 1) − 1. Suppose this is 2w . Clearly, the highest power of 2 in L’s prime
There are at most b − 1 divisors of n that are greater than nb , since divisors come in pairs
factorization is also w.
(k, n/k). However, a > b − 1 and so there would be a row in which all divisors are at most nb .
5
Alternatively, make a graph Gk whose vertices are aℓ and two elements ai , aj are joined if ai +ki ≡ aj +kj But then the sum here becomes at most b · nb = n, contradicting our previous observation.
(mod p).

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 281 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 282
9. Constructions 9. Constructions

Solution 3.7.17 (ELMO 2017/4)


Comment 9.6.2 (Outline of a more Number Theoretic Approach): The above
was, in heart, a combinatorial solution. However, we can use number-theoretic esti- Consider a < n such that gcd(a, b) = 1, or equivalently gcd(a, n) = 1. Then one of a, b has
mates too. no prime factors apart from 2, 5, wlog say a.
Thus, for all large n and any pair (a, b) ∈ N2 with a+b = n such that we have gcd(a, n) =
gcd(b, n) = 1, we have a = 2k 5l or b = 2k 5l for some k, l ∈ N. The number of such pairs for
a fixed n is ϕ(n)/2. Also, since a = 2k 5l < n, the number of such pairs would be at most
Solution 3.7.13 (St. Petersburg Mathematical Olympiad 1998) (log2 (n) + 1)(log5 (n) + 1). Hence, we get for large n,
Assume that it is monotonic for all n ≥ N. Then ϕ(n)
(log2 (n) + 1) (log5 (n) + 1) ≥ .
2 2 2
d((n + 1) + 1) ≥ d(n + 1) + 2
Since n > 2, hence the left side is at most
because d(x) is even if x is not a square. (We would normally have a +1, but here a simple 8
observation helped us to change it to a +2. However, as we will see, the entire solution that (2 log2 n)(4 log5 n) = · (log n)2 = c(log n)2
log 2 log 5
follows hinges on this factor of 2.)

for a constant c (basically O((log n)2 )). However, we know √ϕ(n) ≥ n− n. Now linear growth
So we get for any m ≥ N, 2
is faster than logarithmic growth, hence c(log n) < n − n for large enough n, and we have
our contradiction. 
d(m2 + 1) ≥ d(N 2 + 1) + 2(m − N ).

For large enough m, we find 2(m − N ) > m. Hence d(m2 + 1) > m for all large enough m. Solution 3.7.19 (IMO Shortlist 2016 N2)
We now show this isn’t true for even m. We claim the answer is 2 and all composite numbers. We prove that these work and are
√ 
Half of the factors of m2 + 1 are less than m2 + 1 = m (because divisors come in the only possibilities. Let pi denote primes that are 1 (mod 3) and qj the ones that are ≡ 2
pairs (k, n/k)). Further if m is even, then no even number can be a divisor of m2 + 1. So (mod 3). We first find a formula for d1 (n).
there are at most 2(m/2) = m divisors, which means d(m2 + 1) ≤ m for all even m. This,
Claim. Let n = 3x pα1 1 . . . pαs s q1β1 . . . qrβr . Then
however, contradicts what we had earlier. 
s r
& '
Y 1Y
d1 (n) = (αi + 1) (βj + 1) .
Solution 3.7.16 (IMO Shortlist 2011 N1) i=1
2 j=1
Q
If n = p pα(p) , then d(n) = 2k if and only if we have a sequence β such that for each prime Proof. Since we want divisors that are ≡ 1 (mod 3), hence we don’t want any factor from
P 3. Further, we can arbitrarily choose prime factos from {pi }, however we must have an even
p, α(p) = 2β(p) − 1 = 20 + 21 + · · · + 2β(p)−1 , and p β(p) = k. Hence, any such number n
satisfies d(n) = 2k if and only if number of factors from {qj }.
Q
If (βj + 1) is even, then at least one terms, say (β1 + 1), is even. Then except for q1 ,
Y β(p)−1
Y i
X we can arbitrarily choose primes from {qi }. Then the parity of β1 is uniquely determined by
n= p2 , k= β(p). them, so there are 21 (β1 + 1) choices.
p i=0 p
If all βj + 1 are odd, then the ideais the
 βi +1  same, but slightly more technical. There are
2i k choices for an even βi + 1, and βi2+1 for an odd βi + 1. So we can induct now, the
Let S be the set of integers of the form p as p varies over primes. Then d(n) = 2 when 2
inductive step being:
n is the product of the elements of a finite subset T ⊂ S. Here, T has k terms and if any
t ∈ T , then every divisor s ∈ S of t is also in T . &r−1 '   $Yr−1
%   & Y r
'
Y βr + 1 βr + 1 1
(βj + 1) · + (βj + 1) · = (βj + 1) .
Note that the set Tk consisting of the smallest k elements from S satisfies the condition j=1
2 j=1
2 2 j=1
above. Further, given k, the smallest n with d(n) = 2k is the product of the elements of Tk .
This n is in fact f (2k ). Also, we clearly have Tk ⊂ Tk+1 , which proves the desired result. So the claim has been proven.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 283 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 284
9. Constructions 9. Constructions

Q
Now let n = 3x 2y 5z pα1 1 . . . pαs k q1β1 . . . qrβr . Then let c = (y + 2)(z + 2) (βj + 1). Then This claim implies a2 − a1 ≥ p − 1.

d(10n) (x + 1)c Claim. At most one of np , nq is in G.


=
d1 (10n) ⌈c/2⌉ .
n/q
Proof. This is because n/p
6∈ Z.
So if c is even, then the above becomes 2(x + 1). Here, x can be any non-negative integer.
Hence, all even numbers can be expressed in this way. This claim shows ak − ak−1 ≥ n
. However since a2 − a1 = ak − ak−1 , hence we get
q(q+1)
n
If c is odd, then y, z are odd too, and each βj is even. hence the above ratio becomes p − 1 ≥ q(q+1) , which shows
n ≤ q(pq + p − q + 1) < q 3 .
d(10n) 2(x + 1)c
= . Since n has at least 6 divisors, hence n ∈ {p2 q, pq 2 , pqr} (keeping in mind that q is the
d1 (10n) c+1
second smallest divisor of q). A simple case work along with our claims from above suffice
This is an integer, so c + 1 | 2(x + 1) as gcd(c, c + 1) = 1. Write 2(x + 1) = k(c + 1). So the to show that neither is possible, and we are done. 
above equals
Yr
kc = k(y + 2)(z + 2) (βj + 1). Solution 3.7.21 (China 2015 TST 3/6)
j=1
Firstly observe that n = 6 works. We will inductively find an increasing sequence of working
As y, z are odd, hence y + 2, z + 2 ≥ 3. In particular, this shows the number is composite. integers. They claim is the following:
We now show every odd composite number ab with a, b ≥ 3 is indeed possible (the
ab−1 Claim. If p is a prime, then f (p) = d(p!)/2 and
smallest odd composite number is 3 × 3 = 9). Take n = 3 2 2a−2 5b−2 . Then c = ab and so
 d((2p − 1)!)
d(10n) 2 ab−1
2
+ 1 ab f (2p) > .
= = ab. 2
d1 (10n) ab + 1
Proof. The former is clear. For the latter, let S denote the set of divisors of (2p−1)!
p
, and let
Hence, we are done.
|S| = k. Then, any divisor of (2p − 1)! would be either in S or pS, so d((2p − 1)!) = 2k.
Further, any number in S, pS, p2 S would be a divisor of (2p)!. So d((2p)!) ≥ 3k. Hence
Solution 3.7.20 (China Mathematical Olympiad 2017/5)
d((2p − 1)!
We claim that no n is possible. Let A = {a1 , . . . , ak }. The solution can be broken into a f (2p) = d((2p)!) − d((2p − 1)!) ≥ k = ,
2
bunch of steps:
as claimed.
Claim. n cannot be a prime power.
Now suppose n = ℓ works. Let p be a prime such that 2p > ℓ. Then if n = 2p works, we
Proof. If n = pk , then its divisors are 1, p, p2 , . . . , pk . However, there is no subset with ≥ 3
are done. Otherwise there is a number x < 2p with f (x) ≥ f (2p). Here x cannot be a prime
elements which forms arithmetic progression.
since then f (x) = d(x!)
2
< (2p−1)!
2
< f (2p). Hence x is composite. But then pick the smallest
Let p < q be the smallest prime factors of n. such composite number less than 2p and it works. 

Claim. n ∈ G.
Comment 9.6.3: In fact, n = 2p always works.
Proof. If n ∈ A, then any other element in A is at most n2 . But then the common difference
becomes ≥ n − n2 = n2 , and so A cannot have more than 2 elements.

Claim. At most 1 of 1, p, q are in G. Solution 4.9.9


q
Proof. Clearly p, q cannot both be in G since 6∈ Z. Further, if {1, p} or {1, q} are in G,
p
We claim that the solutions are (a, b) = (k, 1), (l, 11), where k is any integer and l is any
then n ∈ G implies n must be a prime power, which is impossible. integer such that 11|l±1. These work, and now we will show that these are the only solutions.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 285 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 286
9. Constructions 9. Constructions

Firstly assume b > 1, and say that P (n − 1), P (n), P (n + 1) ∈ Z. Then Proof. We make two crucial observations: the first is that if n is odd, then xn −y n , x−y have
the sign, and hence the left side becomes positive. So n is even. The second observation is
P (n + 1) + P (n − 1) − 2P (n) ∈ Z =⇒ b|20n3 + 10n (9.2) that
xn − y n
P (n + 1) − P (n − 1) ∈ Z =⇒ b|10n4 + 20n2 + 2 (9.3) = xn−1 + xn−2 y + · · · + y n−1 ≡ xn−1 ≡ 0 (mod 2)
x−y
Hence, b|2(10n4 + 20n2 + 2) − n(20n3 + 10n) = 30n2 + 4 and b|2n(30n2 + 4) − 3(20n3 + 10n) = if x ≡ y (mod 2). In our case, the pigeonhole principle gives shows that two elements in
−22n. Thus, b|22n, which we will refer to as (3). {a, b, c} have the same parity, giving the desired contradiction since −p3 is odd. Hence the
claim has been proven.
Claim. If p|b, then p = 11. Further, v11 (b) ≤ 1
Now suppose p = 2. Then Equation 9.4 shows that a, b, c have the same parity, otherwise
Proof. If p = 2, then 2|n5 + a and 2|(n + 1)5 + a which implies 2|(n + 1)5 − n5 , which is not an odd number would divide −23 . As before, we can show that n is even, say n = 2k. Write
possible. Equation 9.4 as

Next assume p > 2. Then we must have p ∤ 2n, otherwise (2) =⇒ p|2, absurd. So ak + bk ak − bk bk + ck bk − ck ck + ak ck − ak
· · · · · = −1.
p ∤ 2n, p|22n =⇒ p = 11 Now 11 ∤ 2n =⇒ 11 ∤ n and so v11 (b) ≤ v11 (22n) = 1, and the 2 a−b 2 b−c 2 c−a
claim has been proven Hence each term is ±1. But then ak + bk = ±1. If k is even, then this means |a| = 1 = |b|.
But then ak − bk = 0, contradicting the identity above.
Thus, b = 11 as b > 1 by our assumption. Now we have proven that 11 ∤ n and so (1) =⇒
If k is odd, then a + b | ak + bk = ±2. since a, b have the same parity, hence a + b = ±2.
11|2n2 + 1. Thus n2 ≡ 5 ⇔ n ∈ {4, 7} (mod 11). Now since (4 − 1)5 ≡ 45 ≡ (4 + 1)5 ≡ 1
Similarly b + c, c + a = ±2. But then two of these have the sign, which is impossible since
(mod 11) as well as (7 − 1)5 ≡ 75 ≡ (7 + 1)5 ≡ −1 (mod 11), hence the solutions are indeed
these are distinct integers. Hence we have exhausted all the possibilities.
the claimed ones. 

Solution 4.9.12 Solution 4.9.18 (IMO Shortlist 2017 N6)


We claim the answer is n = 3. Firstly, n = 1 is clearly not possible. So suppose there exist
One solution is (2, 2, 2, 2). Now consider the quadratic x2 − bcdx + b2 + c2 + d2 = 0 with
infinitely many solutions for n = 2. Suppose a + b = x and a1 + 1b = y where x, y ∈ Z. Write
b = c = d = 2. One root is 2, and the other is 6. So (6, 2, 2, 2) is also a solution. Permute
a = p/q with p, q coprime. Then
this to (2, 6, 2, 2) now, and consider the same quadratic with (b, c, d) = (6, 2, 2) this time,
and keep proceeding. 1 1 x q2x
y= + = = .
For instance you get the following solutions in this way: a x−a a(x − a) p(xq − p)

(2, 2, 2, 2) → (6, 2, 2, 2) → (22, 6, 2, 2) → (262, 22, 6, 2) → (34852, 262, 22, 6) → . . . So p | x. Write x = pk. Then
q 2 pk q2k
In fact we can just keep swapping a, b keeping c = d = 2 constant throughout. y= = .
p(pqk − p) p(qk − 1)
Now, clearly gcd(qk − 1, q 2 k) = 1, hence we must have qk − 1 = 1, i.e. qk = 2. If q = 1,
Solution 4.9.17 (IMO Shortlist 2008 N1) then a is an integer and x = 2a, meaning b = a. But then ab | a + b and so a = b = 1 or 2.
If two of a, b, c are equal, then it is easy to see that all must be equal. So assume all are If q = 2 and k = 1, which means x = p and a = p/2. But then p | 4 and so a = b = 12 . So we
pairwise distinct. Now we get relations of the form an − bn = −p(b − c). Multiplying them only have finitely many possibilities.
gives our key identity Now we show the result for n = 3. Here, we take
an − bn bn − cn cn − an  
· · = −p3 . (9.4) 1 x y
a−b b−c c−a , ,
1+x+y 1+x+y 1+x+y
Now suppose that p > 2. We show that, in fact, being prime is too strong a condition, the
following more general claim is also true: where x, y are positive integers. Then we just want
x+1 y+1
Claim. Equation 9.4 cannot hold for any odd integer p. + ∈Z
y x
c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 287 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 288
9. Constructions 9. Constructions

for infinitely many (x, y) ∈ N2 . Let’s see how we do this. Suppose the above is k for some k. Solution 4.9.20 (China TST 3 2018 Day 3/2)
Suppose for some k we have a solution (x, y) with x ≤ y. We thus get the equation We will show that there are no solutions. Firstly, gcd(xy+1, xy+x+2) = gcd(xy+1, x+1) =
x2 − (ky − 1)x + y 2 + y = 0, and now employ vieta jumping. Let the other root be x0 . Then gcd(y − 1, x + 1). So let x + 1 = da and y − 1 = db, where gcd(a, b) = 1. Then we have
xx0 = y 2 + y > 0 and x0 = ky − 1 − x ∈ Z. Hence, x0 ∈ N. So we jump
xy + 1 = d · u2 and xy + x + 2 = d · v 2
 2 
y +y for some relatively prime (u, v). Thus, du2 = d2 ab + d(a − b) and dv 2 = d2 ab + d(2a − b). So,
(x, y) 7→ ,y .
x
(d · b + 1)v 2 − (d · b + 2)u2 = b.
Now, if can show x0 > y, then we have found a larger pair, and we can keep on proceeding Since v > u, we can let v = X+Y
and u = X−Y
for some positive integers X and Y . Thus
2 2
forever. But this is clear since the equation becomes
X 2 − (4bd + 6)XY + Y 2 + 4b = 0.
y2 + y y2 + y
≥ = y + 1 > y. Vieta jumping works now: assume for contradiction there is a solution (X, Y ) in positive
x y
integers. Assume X ≥ Y by symmetry. We jump
So we went (x, y) 7→ (x0 , y) where x ≤ y < x0 . Now we need to pick a suitable k such that  2
Y + 4b

we have a valid solution at the start. if k = 4, then (x, y) = (1, 1) works and we get (X, Y ) 7→ ,Y .
X
(1, 1) → (2, 1) → (2, 6) → (21, 6) → (21, 77) → . . . . We give a different finish than what we normally do in Vieta Jumping. Suppose we must
eventually reach a pair of pairs (X1 , Y ) and (X2 , Y ) with X1 > X2 ≥ Y, so that the proces
stops there. This means that we should have X1 + X2 = (4bd + 6)Y and X1 X2 = Y 2 + 4b.
Solution 4.9.19 (IMO Shortlist 2019 N8)
But since X1 , X2 > Y, hence X1 + X2 = (4bd + 6) · Y , then
Assume on the contrary. Then there exists an 0 ≤ f < b such that the equation becomes X1 · X2 ≥ Y · (4bd + 5)Y > Y 2 + 4b,
4a2 + f a contradiction. So the process goes on forever, which again is a contradiction.
a2 + = c2
b
for some c. Clearly, c > a(> 0). This rearranges to Solution 5.9.14 (Iran 2016 Round 3 NT/1)
Clearly, we must have that q ∤ x because otherwise q|(x + 1)p − xp would imply q|1, absurd.
(b + 4)a2 − bc2 = −f.
Suppose (x + 1)p ≡ xp (mod q). Since gcd(q, x) = 1, hence this gives
2 p
So the above becomes b(a − c)(a + c) + 4a = −f. So if we write x = a + c and y = c − a, x−1 + 1 ≡ 1 (mod q).
then the above becomes
Let a = x−1 + 1. Then, ordq (a)|p and since p is a prime, we have ordq (a) ∈ {1, p}. If
 2
x+y ordq (a) = 1, then a ≡ 1 (mod q), which implies x + 1 ≡ x (mod q), absurd. Hence,
−xyb + 4 = −f ⇐⇒ x2 − (b − 2)xy + y 2 + f = 0. ordq (a) = p. So we find p | q − 1 and so q ≡ 1 (mod p).
2
Conversely, if p|q − 1, then set q = pk + 1 for some integer k. We know that there
We now employ Vieta Jumping. Since c > a, hence x, y ∈ N and x > y ≥ 1. From a solution always exists a primitive root modulo any prime. Let y be a primitive root modulo q, so
(x, y), we jump:  2  that y q−1 ≡ 1 (mod q). Let a = y k and note that
y +f
(x, y) 7→ (x0 , y) = ,y , ap = (y k )p = y pk = y q−1 ≡ 1 (mod q).
x
Also note that gcd(a − 1, q) = gcd(y k − 1, q) = 1 since y is a primitive root mod q and
Now, x0 = (y 2 + f )/x > 0 and is an integer since it equals b − 2 − x. So if we can show
k < q − 1. So there exists an integer x such that x(a − 1) ≡ 1 (mod q). This implies
x0 < x, then we have established a descent. Note that x0 < x ⇐⇒ y 2 + f < x2 . Now,
x + 1 ≡ xa (mod q). Raise both sides of the latter congruence equation to the power of p to
x2 − y 2 = 4ac > 4a2 = b(c2 − a2 ) − f > b > f obtain
(x + 1)p ≡ (xa)p ≡ xp (mod q).
since c2 − a2 = (c − a)(c + a) > 2. Hence, we are done.  Thus, this value of x works, and this completes the proof.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 289 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 290
9. Constructions 9. Constructions

Solution 5.9.17 (USA EGMO TST 2019/2) no multiple between x, x + ℓ. Hence, x can be 1, 2, . . . , c − ℓ − 1 (mod c). So, we have the
following conditions:
Define

Sℓ := 1ℓ + 2ℓ + · · · + nℓ , x ≡ 0 (mod a)
 ∀ a ∈ A;
so that n | Sℓ for all ℓ ∈ {1, 2, . . . , 99}. Let p be a prime in {2, 3, . . . , 100}. Then x ≡ −ℓ (mod b) ∀ b ∈ B; .


x ∈ {1, 2, . . . , c − ℓ − 1} (mod c) ∀ c ∈ C = (A ∪ B)c .
n
(n + 1)p − 1 1X
= (i + 1)p − ip The key observation now is that any marked point in I is precisely defined by its value
n n i=1
n       (mod ai ) for all i.6 Hence the above constraints uniquely define ai .
1 X p p−1 p p−2 p
= i + i + ··· + i+1 The final observation is that A, B can be any disjoint subsets of {a1 , . . . , an }. Hence, the
n 1 2 p−1
i=1      number of segments with length ℓ becomes
p Sp−1 p Sp−2 p S1 X Y
= + + ··· + +1 (c − ℓ − 1).
1 n 2 n p−1 n
A∩B=φ c∈(A∪B)c
Since each binomial coefficient on the right is divisible by p, and each fraction is an integer
by the hypothesis, hence modulo p, the above gives Hence, our desired sum becomes
aX
1 −1
(n + 1)p − 1 X Y
≡1 (mod p). ℓ2 (c − ℓ − 1).
n ℓ=1 A∩B=φ c∈(A∪B)c

However, if p | n, then the left side is This feels weird, but here’s how the magic happens: Note that the sum over A, B is the same
p−1 p−2 for all ℓ, and the product after it is a polynomial in ℓ, say p(x). So the above becomes the
(n + 1) + (n + 1) + · · · + (n + 1) + 1 ≡ 1 + 1 + · · · + 1 ≡ 0 6≡ 1 (mod p),
sum of p(ℓ) from ℓ = 1 to a1 = 1. Since |A|, |B| ≥ 1, hence deg p ≤ 2 + (n − 2) = n ≤ a1 − 2.
which is a contradiction. Thus, no prime in {2, 3, . . . , 100} divides n, so done. Now since
1i + 2i + · · · + (p − 1)i ≡ 0 (mod p)

Comment 9.6.4: The power sum formula works for k = 1, 2, 3, however we don’t for all 0 ≤ i ≤ p − 2 (Example 5.5.1), hence the above sum is 0 mod a1 (as ai is a prime),
have any (simple) formula for k ≥ 4. So, we fall to first principles, which in this case and we are done!
is the proof of the cases k = 2, 3 which solves the problem!
Comment 9.6.5: The idea we saw at the end will be repetitive in the chapter on
quadratic residues. To write it out explicitly, for instance with f (x) = x3 + 2x + 1 and
p = 5, we have
Solution 5.9.18 (IMO Shortlist 2014 N6) p−1 4
X X
The idea is to group up segments of the same length, i.e. for a possible length ℓ, find how f (x) = x3 + 2x + 1
many segments can have length ℓ. Clearly, 0 < ℓ < a1 otherwise there would be a multiple x=1 x=1
! !
4 4 4
of a1 inside L, hence ℓ ∈ {1, . . . , a1 − 1}. Pick any one segment L of length ℓ. Now, L is X X X
characterized by its endpoints. = x3 + 2 x +1 1
x=1 x=1 x=1
So we can find a subset A ⊂ {a1 , . . . , an } and a subset B ⊂ {a1 , . . . , an } such that the ≡0+0+0=0 (mod 5)
left endpoint of L is divisible by elements A and the right by elements of B. So we basically
want x such that x ≡ 0 (mod a) for all a ∈ A, x ≡ −ℓ (mod b) for all b ∈ B. Basically, we pair up terms according to their powers, and irrespective of their coeffi-
Another condition we need to ensure is that no multiple of any other terms lies inside cients, they add to 0.
L. Clearly, no multiple of an element from A or B can be inside L because ℓ < a1 < ai for
all i. Also, A, B are disjoint for the same reason. So let C = (A ∪ B)c , i.e. the elements 6
This is quite intuitive, however to formalize it we use the ”Chinese Remainder Theorem”, which we
in {a1 , . . . , an } not in A or B. So for any c ∈ C, we want no multiple of c inside L, i.e. discuss in the chapter on Constructions.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 291 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 292
9. Constructions 9. Constructions

Solution 6.7.17 (Iran 2017 Round 3 NT/1) Solution 6.7.20 (Tuymaada Olympiad)
Let p be the smallest prime not in the list p1 , p2 , . . . , pk . Out of all νp , let s be the maximum Write this as
achieved for aw . The key claim is the following:
10n ((n1 + 1) . . . (nk − 1)nk + · · · + (nk−1 + 1) . . . (nk − 1)nk + 1) = nk !.
Claim. For all i 6= w, we have νp (ai ) < s.
Proof. Suppose νp (ai ) = s, and write ai = cps . Now both ai , aw cannot be equal to ps , so Let the quantity in the bracket be S, so that 10n S = nk !. So nk | 10 so write nk = 2a 5b . Now
assume without loss of generality that ai 6= ps , i.e. c > 1. Then c can’t have any prime factor we analyze the possible values of a, b:
from p1 , . . . , pk and further p ∤ c. By minimality of p, this means c > p. Hence, ps+1 < ai < n.
But then one of {aj } must equal ps+1 , contradicting the maximality of s. • Suppose a, b > 0. Then 10 | nk and so gcd(S, 10) = 1. But 10n S = nk !, and so we must
have ν2 (nk !) = ν5 (nk !). However, clearly
The claim finishes the problem since νp of the sum equals min νp (a−1
w ) = −s < 0.
X j nk k X j nk k
ν2 (nk !) = ≥ = ν5 (nk !)
Comment 9.6.6: This is a generalization of the two classic problems asking to show 2j 5j

1 1 1 1 since ⌊nk /2j ⌋ ≥ ⌊nk /5j ⌋ . Hence equality holds so that ⌊nk /2j ⌋ = ⌊nk /5j ⌋ for all j.
Hn = 1 + + · · · + 6∈ Z, 1+ + ··· + 6∈ Z.
2 n 3 2n − 1 This, however, means nk ≤ 3, and these cases can be manually ruled off.

In the first one, the set {pi } = φ, and in the second case {pi } = {2}. The proofs are • Suppose b = 0. Then 2 | nk so S is odd. Hence, ν5 (nk !) ≥ ν2 (10n ) = ν2 (nk !) (because
also identical, for instance in the first we consider ν2 and 2 is the smallest prime factor S might contribute some factors of 5). As before, this is impossible.
not in {pi }. Further, we show ν2 (Hn ) = −k where k is such that 2k ≤ n < 2k+1 , which
was possible since νp (i−1 ) 6= −k for any other i. This is precisely what we did here. • Suppose a = 0. Then 5 | nk so gcd(5, S) = 1. Now, the key observation in this
case is that S is odd if nk > nk−1 + 1. However, as before S odd causes issues. So
nk = nk−1 + 1. But then 4 | nk − 1 (since nk is a power of 5), hence S ≡ 2 (mod 4), i.e.
ν2 (S) = 1. Hence, ν2 (nk !) = 1 + ν2 (10n ) = n + 1 = ν5 (nk !) + 1. As before, this means
Solution 6.7.18 (China TST 2 2019/4)
⌊nk /2⌋ = 1 + ⌊nk /5⌋ and so nk ≤ 6. Since nk is a power of 5, hence nk = 5, nk−1 = 4,
Pick an odd prime p. Let pk ≤ m < pk+1 . Then we have to prove which can be checked to not work.
   
m m
νp (m!) − − − · · · ≥ k.
2p 4p Solution 6.7.23 (USA TSTST 2014/6)
t t+1
Let 2 p ≤ m < 2 p. Then Let s be the order of a · b−1 . Then the terms in the sequence divisible by p are precisely those
   
m m
  
m m m
 
m m
 of the form cak − dbk , cak+s − dbk+s , cak+2s − dbk+2s , . . . . So define
+ + ... ≤ + + + ... − t+1
+ t+2 + . . .
2p 4p 2p 4p 8p 2 p 2 p
  as dbk
m m m A= , B= .
= + − . bs cak
2p 2p 2t p
Then we have reduced the problem to:
Since the Legendre’s formula of νp (m!) has only k non-zero terms, hence we can split that
νp (m!) − k to the sum of (⌊n/ps ⌋ − 1) where s = 1 to k. Hence, Claim. Let A, B ∈ Q+ and p be a prime such that A ≡ B ≡ 1 (mod p). Consider the

m
  
m
 
m
  
m
    
m m

sequence {An − B} as n goes over non-negative integers. Then we need to show that if
νp (m!) − k − − − ... = − 1 + ··· + −1 − + + ...
2p 4p

p
  
pk 2p
  
4p
   
{νp (At − B)}∞
t=0 is not constant, then it is unbounded.
m m m m m m
> −1 −1− − + t + − 1 + ... −1
p 2p 2p 2p p2 pk Assume on the contrary x, y such that u = νp (Ax − B) < νp (Ay − B) = v. It is enough
    
m m
≥ −1 + − 1 ≥ −1. to construct a ℓ such that νp (Aℓ − B) > v. Then
2p 2t p

Hence, the LHS is ≥ 0 (as it’s in integer) and hence we are done.  νp (Ay−x − 1) = νp ((Ay − B) − (Ax − B)) = ν(Ax − B) = u.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 293 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 294
9. Constructions 9. Constructions

So using LTE, we can find a k such that νp (Ak − 1) = v, namely k = (y − x)pv−u . Now write The key hypothesis we need now is that ai are pairwise distinct. We want to try to force
Ak = pv α + 1 and Ay = pv β + B with gcd(p, α) = gcd(p, β) = 1. Then (using the binomial νp (ai ) = νp (aj ) for all primes to get a contradiction. It is not too hard to observe from
theorem) Equation 9.5 that that any prime divisor of ak must divide Ca1 . So we only need to worry
about a finite set of prime factors, say P = {p1 , . . . , pk }.
Akr+y − B = (pv α + 1)r (pv β + B) − B
≡ (rpv α + 1)(pv β + B) − B We have the famous estimate for Hn :
= pv (rαB + β) (mod pv+1 ).
Hn ≤ 1 + log(n + 1) =⇒ Hn ≤ log n + log n2 = 3 log n.
So if we choose r such that r ≡ −β/(Bα) ≡ −β/α (mod p), then the above becomes 0.
Thus, νp (Akr+y − B) ≥ v + 1. This gives the desired contradiction.  (basically Hn = O(log n)7 ). Now for any prime p ∈ P and any n ≥ 1,

νp (an ) ≤ Hn−1 νp (C) + νp (a1 ) ≤ A log n


Solution 6.7.24 (ELMO 2017 N3)
The answer is no. Suppose not for a fixed C. Consider any prime p. Then the problem gives for some large enough A (since P is a finite set, hence νp (C), νp (a1 ) are always less than some
fixed constants).
kνp (ak+1 ) ≤ kνp (C) + νp (a1 ) + · · · + νp (ak ). (9.5)
Hence if we look at k tuples of the form (νp1 (an ), . . . , νpk (an )), then there are at most
Now we have the following key claim (guessed by small values)
k
Y
Claim. Let Hn denote the nth harmonic number defined by (1 + A log n) ≤ (B log n)k
1 1 1 i=1
Hn = + + ··· + .
1 2 n
for some large enough constant B (basically the product is O((log n)k ).)
Then
νp (an ) − νp (a1 ) ≤ Hn−1 νp (C). However, the number of tuples also has to be at least n + 1 (because if two tuples are
the same, then the numbers are the same).So
Proof. The proof is just strong induction on n. Firstly, put k = 1 in Equation 9.5 to get
(n + 1) ≤ (B log n)k
νp (a2 ) − νp (a1 ) ≤ 1νp (C),
which serves as the base case since H1 = 1. Now assume the result till some n. Then putting for all n. However, clearly this fails for large enough n since linear growth exceed logarithmic
k = n in Equation 9.5, we find growth.

nνp (an+1 ) ≤ nνp (C) + νp (a1 ) + νp (a2 ) + · · · + νp (an )


≤ nνp (C) + νp (a1 ) + (νp (a1 ) + H1 νp (C)) + · · · + (νp (a1 ) + Hn−1 νp (C))
Solution 7.7.9 (USAMO 1995/4)
= nνp (a1 ) + (n + H1 + · · · + Hn−1 ) . Let the degree of P be d. Then |qn | < Cnd for some c 6= 0 and all n.
and hence Define the polynomial Q by Q(i) = qi for all 0 ≤ i ≤ d. Then it suffices to show Q(n) = qn
1
  
1

1 1
 for all n.
νp (an+1 ) − νp (a1 ) ≤ n+ + ··· + + ··· +
n 1 1 n−1 Pick any n and 0 ≤ i ≤ d. Then
  
   
1  1 1 1 1 1 1 1  n − i | qn − q i , and n − i | Q(n) − Q(i) = Q(n) − qi
= 1 + + + · · · + + · · · +  + + ··· + + ··· + 
n 2
| {z }2 n
| {z n} 1 1 n − 1
2 n Thus, we get n − i | Q(n) − qn for all 0 ≤ i ≤ d. If Q(n) − qn 6= 0, then we get the bound
 
1 1 1 1
= n · + n · + ··· + n · = Hn . lcm(n, n − 1, . . . , n − d) ≤ Cnd .
n 1 2 n
and the induction is complete. 7
Relevant Term for interested readers: ”Big O Notation”

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 295 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 296
9. Constructions 9. Constructions

The heuristic is that this cannot be true for large enough n. To formalize it, we would need Considering this over all k, we find 2Q(n) − 1 divides 3T − 1 where
some more rigorous bounding. There are many ways to do this. One way is to observe that
T = hgcd(P (n + kQ(n)))i∞
z=−∞ = gcd(. . . , P (n), P (n + Q(n)), P (n + 2Q(n)), . . . ).
lcm(n, n − 1, . . . , n − d) = lcm(lcm(n, n − 1, . . . , n − d + 1), n − d)
We want to show that T is bounded by a constant, which would show deg Q = 0.
lcm(n, n − 1, . . . , n − d)(n − d)
=
gcd(lcm(n, n − 1, . . . , n − d + 1), n − d) Claim. Suppose p | T. Then νp (T ) is bounded.
lcm(n, n − 1, . . . , n − d)(n − d)
≥ Proof. Let pM be a prime power that divides T. If pM | Q(n), then pM | P (n) so pM | N
gcd(n(n − 1) . . . (n − d + 1), n − d)
hence M is bounded.
lcm(n, n − 1, . . . , n − d)(n − d)
≥ So say pM ∤ Q(n). If p ∤ Q(n) then P (x) + zQ(x) forms a complete residue class mod p,
d!
and hence pM | P (k) for all k. In particular, pM | P (1), so that M is bounded.
where the last line is because if p | gcd(n(n − 1) . . . (n − d + 1), n − d), then p | n + i, n + d
So let νp (Q(n)) = t and write Q(n) = pt ℓ. Then pM | P (n + zℓpt ) for all z. However
implies p | d − i, which means p ≤ d − i < d. Further, there are atmost
gcd(p, ℓ) = 1, so this gives pM | P (n + zpt ) by the complete residue class argument. So for
This is just a generalizat a choice of z, n + zpt is between pt and 2pt , say equals r (this is modulo pM ). But then
P Now, we can show thatd+1 n(n
 − 1) . . . (n − d) | lcm(n, n − 1, . . . , n − d)T, where T = pM | P (r), which shows P M < rd < Cptd , so that M < C ′ t for fixed C ′ .
i6=j gcd(n − i, n − j) < d 2 = k. So,
But since pt | P (n), Q(n), hence pt | N so t is bounded. So M < C ′ t also is bounded.
Cnd ≥ kn(n − 1) . . . (n − d). Now we just want primes dividing T to be bounded. Let p | T , then pick p > N so
p ∤ Q(n), and p | P (n). Now p | P (k) for all k. Thus, p | P (1), so in all, p ≤ max(P (1), N ),
However, this fails for large n since the right side is a degree d + 1 polynomial. for some hence there are only finitely many primes diving T. We are thus done.
ε > 0. This fails for large n. So for all n > N, we have Q(n) = qn . For some d < n < N,
we get by m − n | Q(n) − qn for any m > N, which is absurd due to size reasons unless
Q(n) = qn , and so we are done. Solution 7.7.17 (2020 Korean MO winter camp Test 1 P3)
We claim the answer is Q(x) = Axd , which clearly works. Now let Q(x) = xd R(x) so that
Solution 7.7.10 (Iran 2016 Round 3 NT/2) R(0) 6= 0. We aim to show R is constant. Assume that R is not constant and take any
m > R(0). Thus m ∤ R(mc ) for any c.
Suppose that P is non-constant, and without loss of generality the leading coefficient of P is
positive. Hence, for large enough n, we have P (n) > 2. This means there is a prime p | P (n), Claim. R(mc ) and R(m) have the same prime divisors for any c.
and so p | P (n + pk) for all k. This also shows p | f (n + pk). 2
Proof. Firstly, the second condition shows R(m), R(m2 ), R(m2 ), . . . all have the same num-
Now Fermat’s Little Theorem gives us f (m) ≡ f (n) (mod p) if m ≡ n (mod p − 1). ber of prime divisors.
Hence, f (n + pk) ≡ f (n + k) (mod p). Thus, if we pick k such that p − 1 | n + k, then
Now suppose R(mc ) and R(m) have the same prime divisors. Since R(m · mc−1 ) and
p | P (n + pk) implies p | f (n + pk) ≡ f (n + k) ≡ f (0) (mod p). Hence, p | f (0). But since
R(m)R(mc−1 ) have the same prime divisors, hence every prime divisor of R(mc ) is a prime
f is non-zero by the hypothesis, hence this shows p is bounded, a contradiction to Schur’s
divisor of R(m). But R(mc−2 · c) and R(mc−2 )R(c) have the same prime divisors, and since
Theorem. 
R(mc−2 ) > 1, hence R(mc−1 ) has at least as many prime divisors as R(c). So, R(mc−1 ) and
R(m) have the same divisors.
Solution 7.7.16 (IMO Shortlist 2011 N6) k
So from every R(mm ) we can induct down to prove the claim.
Firstly, since P (x), Q(X) are coprime over Q[X], hence by Bézout’s lemma there exist poly- Let q | R(m). We also have m ∤ R(m). Suppose gcd(q, m) = 1. So by Fermat’s Little
nomials A, B ∈ Q[X] such that P A + QB = 1. We can multiply both sides by a constant so Theorem, q | R(mq−1 ) ≡ R(1), and hence q | R(1). So q is bounded (note that R(1) ≥ 1 by
that this becomes P a + Qb = N for a fixed N ∈ Z and a, b ∈ Z[X]. the hypothesis and so R(1) 6= 0). Otherwise q | m. But then q | R(m) ≡ R(0), which is not
Now we use f (n) | f (n + kf (n)) for all z ∈ Z. Thus, Q(n) | Q(n + kQ(n)) for all n and zero since we assumed x ∤ R(x).
z. So, Either way, q is bounded for any choice of m. However, by Schur’s theorem this is a
2Q(n) − 1 | 2Q(n+kQ(n)) − 1 | 3P (n+kQ(n)) − 1. contradiction unless R is constant, and hence we are done.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 297 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 298
9. Constructions 9. Constructions

Solution 8.7.13 (AMM) Proof. Since (p − 1)/2 = q is odd, hence −1 is not a quadratic residue. So

Clearly n = 1 is a solution. We will show that there is no other solution. Clearly, n is odd     
−4 22 −1
since 3 ∤ 2n − 1. = = −1.
p p p
Pick a prime divisor p of 2n − 1. Then 3n+1 ≡ 3 (mod p) implies 3 is a quadratic residue
mod p. Hence, the quadratic reciprocity law gives So −4 is a primitive root. Now, 3 isn’t a primitive root if it is a quadratic residue. Now
q > 3, and hence p = 2q + 1 ∈ {2 · 1 + 1, 2 · 2 + 1} ≡ {0, 2} (mod 3). Since p > 3, we get
  p ≡ 2 (mod 3). So, by quadratic reciprocity,
3 p−1 3−1  p 
1= = (−1) 2 · 2 ,
p 3   p
3
= (−1)q = (−1) · (−1) = 1.
and so p ≡ ±1 (mod 12). This is true for all prime factors of 2n − 1, and hence 2n − 1 ≡ ±1 p 3
(mod 12), which gives 2n ≡ 2 or 0 (mod 12). The latter is impossible, and the former is only
possible if n = 1. Hence we are done. Hence, 3 is a quadratic residue. Finally,
    
−12 −1 3
= = −1
Solution 8.7.14 (Taiwan 1997) p p p

First say that k is a prime. Clearly we just have to show that k is a quadratic nonresidue. meaning that −12 is a primitive root. Hence we are done.
n−1
Since n > 0, hence k ≡ 1 (mod 4). Further, k = 42 + 1 ≡ 2 (mod 3). Hence
    Now, rewrite the given condition:
3 p−1 k
= (−1) 2 = −1.
k 3 3 + (−12)m ≡ 3n + (−12)n
m
(mod p) ⇔ 1 + (−4)m ≡ 3n−m + (−4)n · 3n−m (mod p)

k−1
⇔ 1 − 3n−m ≡ (−4)m (−12)n−m − 1 (mod p).
Now for the other direction, since 3 2 ≡ −1 (mod k), hence 3k−1 ≡ 1 (mod k). In particu-
n n−1 n
lar, ordk (3) | k − 1 = 22 but ordk (3) ∤ k−1
2
= 22 . Hence the order is k − 1 = 22 . Now 3n−m ≡ 1 (mod p) happens if q = ordp (3) | n − m. If this is not true, then the above is
But then the order divides ϕ(k), and hence k−1 ≤ ϕ(k). However, this means all elements  −1
in {1, 2, . . . , k − 1} are coprime to k, showing that k is a prime. (−4)m ≡ (−12)n−m − 1 · 1 − 3n−m (mod p).

Now, the right depends completely on n − m. Also, since ordp (3) = q, hence each value of
Solution 8.7.15 (ELMO 2011/5) n − m between 1 and q − 1 (we are not considering q ∤ n − m) gives a different value for the
right side. Now since (−4) is a primitive root, hence there would exist some m such that
The conditions p = 2q + 1 gives the following key claim: (−4)m is congruent to the right side.
Claim. Any residue x ∈ {3, −4, 12} is a primitive root if and only if it is not a quadratic Hence, for every n − m, there exists a m. Now each (m, n − m) pair uniquely gives a
residue. (m, n) pair. Hence, the fact that there are q − 1 values of n − m means q − 1 solutions in
this case.
Proof. Generally, being a primitive root implies not a quadratic residue. In this case, how-
ever, the converse holds too. Since ordp (x) | p − 1 = 2q, hence ordp (x) ∈ {1, 2, q, 2q}. For So, we just need to deal with the case when q | n − m. In fact, if q ∤ n − m, then
our values of x, we can check that 1, 2 are not possible as p > 13. So, the order being a our equation gives 0 ≡ (−4)m ((−1) − 1) (mod p) since ordp (−12) = 2q. However, this is
quadratic residue is equivalent to the order being q, which implies it is not a primitive root, impossible. Hence no solutions in this case. So the q − 1 solutions we analyzed above are
and this proves the claim. the only ones.

The next claim is more explicit: Solution 8.7.16 (Iran TST 2020/6)
Claim. −4, −12 are primitive roots modulo p, while 3 isn’t, i.e. ordp (−4), ordp (−12) = 2q The answer is all sets in which xi ∈ {0, 1} for all i. Clearly it works, so now we will prove
while ordp (3) = q. that this is the only possibility.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 299 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 300
9. Constructions 9. Constructions

The key idea in this approach is to expand (txi + 1)n and sum over all xi to use the given Claim. If p | aj , then p | aj±k .
condition. The fact that n = p−1
2
is made use of by Euler’s Criterion. Let s be the common
sum in the problem statement. Then Since gcd(k, p) = 1, hence the above claims give p | ai (for instance use Bézout Lemma
X  wxi + 1  X to find u, v such that ku + pv = d for any integer d. Then 0 ≡ a1 ≡ a1+ku ≡ a1+ku+pv = a1+d
≡ (wxi + 1)n (mod p) for any integer d). Then we can divide all the terms of the sequence by p and obtain
i
p i a ”smaller sequence”, and keep repeating this process to show that the set of prime factors
   
X n n is the same for all terms.
= (wxi )n + (wxi )n−1 + · · · + (wxi ) + 1
i
1 n−1
  
n n−1

n
 
Solution 8.7.18 (USOMO 2020/3)
≡ s wn + w + ··· + w+1 +n−s
1 n−1 We claim the answer is always 2 irrespective of p. Define the set B = {b : b, 4 − b ∈
  
w+1 QR}\{0, 4}. We work in Fp , so that each equality below is actually a congruence mod p.
=s − 1 + n (mod p).
p Define X = (A ∪ B)\{2}. We start by establishing the following key claim:
So, picking w + 1 to be a quadratic residue, we can prove the following key result: Claim. For any b, b ∈ B ⇔ b = x(4 − x) for some x ∈ A or B.
Claim. Whenever t is a quadratic residue with t 6= 0, 1, then (t − 1)xi + 1 is a non-zero
quadratic residue for all i. Proof. Clearly for x ∈ A or B, x(4 − x) is a QR. Now suppose b ∈ B. Then
It turns out this claim is sufficient to solve the problem. Consider T to be the set of 4 − b = y 2 ⇐⇒ b = 4 − y 2 = (2 − y)(2 + y).
quadratic residues not equal to 0 or 1. Fix some x = xi . Suppose x 6= 0. Then we can see
that the map So take x = y + 2. Then x(4 − x) is a QR and so x ∈ A or B, and b = x(4 − x) so this
T 7→ T : t 7→ (t − 1)x + 1 works.
is a bijection by the claim. So we have two equal sets. We now add and compare the elements
The claim gives us a natural mapping from f : X 7→ B given by x 7→ x(4 − x), which
from both the sets. Since X is in B. The key observation now is that f (α) = f (β) ⇐⇒ α = β or α + β = 4. Hence,
t ≡ −1 (mod p)
for x 6= 2, each pair (x, 4 − x) ∈ X 2 maps to a unique element of B, and this covers all the
t∈T
elements of B. Hence,
for all p > 3, hence
x(−1 − (n − 1)) + (n − 1) ≡ −1 (mod p), ! ! !
Y Y Y Y Y
which gives x ≡ 1 (mod p), as desired.  2 b= x = a b =⇒ a = 2.
b∈B x∈X a∈A b∈B a∈A

Solution 8.7.17 (USA TST 2014/2)


Solution 9.6.10 (APMO 2009/4)
Firstly note that each term of the sequence is also a square. Now let p | a1 . Then p |
(a1 + · · · + ap ) and p | (a2 + · · · + ap+1 ). Hence a1 ≡ ap+1 (mod p). In a similar way we can Pick a set P of n primes p1 , . . . , pn such that p1 > p2 > · · · > pn > n. Then, using the
prove the following more general claim: Chinese Remainder Theorem, pick an x such that

Claim. If p | aj , then p | aj±p . x ≡ −i (mod pi )


Now let k > 1 be the least quadratic non-residue modulo p. Let Z 2 denote the set of
perfect squares. Then for all i. Pick N = p1 p2 · · · pn . We then claim that the following fractions (on being reduced)
work:
2
kZ ∋ a1 + · · · + ak ≡ a2 + · · · + ak ∈ (k − 1)Z 2
(mod p). x+1 x+n
,...,
    N N
k
However, unless p | a2 +· · ·+ak , this is impossible since it shows p = k−1 , contradicting
p Clearly gcd(x + i, x + j) = gcd(x + i, j − i) ≤ |j − i| < n < pi , pj . So for each i, the only
minimality of k. Thus p | a1 + · · · + ak . But then prime from P dividing xi + i is pi . Thus
Z 2 ∋ ak+1 ≡ a2 + · · · + ak+1 ∈ kZ 2 (mod p),
x+i (x + i)/pi
which is impossible again unless p | ak+1 . In general, =
N N/pi
c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 301 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 302
9. Constructions 9. Constructions

is the reduced form of each fraction. The reduced denominators of all the fractions are Solution 9.6.16 (EGMO 2018/6)
clearly distinct. Also, no reduced numerator would equal a reduced denominator since the
only p ∈ P dividing x + i is pi . Let S = {a1 , · · · , an } where ai < aj when i < j. Since ai ∈ N, hence an ≥ a1 + n − 1, which
x+j pi
implies that aan1 can get arbitrarily small for large n. So take m = 0, and choose a sufficiently
Finally we see that that if for some j > i, we have x+i
pi
= pj
, then x+i
x+j
= pj
> 1 =⇒ large n such that
i > j, absurd. Hence, the numerators are also pairwise distinct. a1
−0 <t
an
Solution 9.6.13 which is enough to solve the first part. 
Assume without loss of generality that the number n is square-free. Suppose n = p1 p2 . . . pk . The answer to the second part is yes. We construct this set recursively. They key
We will show that there exist arbitrarily large primes p such n is a quadratic nonresidue mod observation is that for any x, y ∈ S, we must have
p. We do this very greedily. Now  
    x x mod y
pi pi −1 p−1 p 1−t> >t⇔1−t> > t.
= (−1) 2 · 2 , pi 6= 2. y y
p pi
x−1

Hence, if we set p ≡ 1 (mod 4) and p ≡ 1 (mod pi ), then the right side above becomes +1 Note that f (x) = x2 get closer to 21 as x increases. So we act greedily and choose a prime
meaning that pi is a quadratic residue mod p. On the same note, if we choose p to be a p1 such that 1 − t > 12 > f (p1 ) > t. So set p1 to be the first element of S. Then, by Dirichlet,
quadratic nonresidue mod pi , then the right side becomes −1 and hence pi is a quadratic we can choose a prime p2 such that p2 ≡ p12−1 (mod p1 ) and p2 > 2p1 . Next, choose a prime
nonresidue mod p. So set up the system: (also if pi = 2, then pi is a QR mod p if p ≡ 1 p3 such that  p −1
(mod 8), so we set p ≡ 1 (mod 8) below instead of just p ≡ 1 (mod 4))  p3 ≡ 12 (mod p1 )
 p3 ≡ p22−1 (mod p2 )
p ≡ 1 (mod 8)

 p3 > 2p2
p ≡ 1 (mod pi ), 1 ≤ i ≤ k, pi 6= 2 Such a prime exists by Dirichlet and The Chinese Remainder Theorem. Proceed and con-


p ≡ a (mod pk ) struct the primes pi for all i ≥ 1. Then we claim that the infinite set
where a is a quadratic nonresidue mod pk , then by Chinese Remainder Theorem the above
S = {p1 , p2 , p3 , · · · } works.
gives us a congruence p ≡ z (mod N ). By Dirichlet’s theorem, this has infinitely many prime
solutions, and for any such p, The reason is simple. Firstly, see that for j > i, 0 < ppji < 21 and since m 6= 0, hence this
  n o 
p
      works. Also, if j > i, then pji = f (pi ), which by assumption lies in t, 21 . 
n  Y pi  pk = −1.
=
p  p
1≤i≤k−1 | {z }
 p
| {z }
+1 −1
Solution 9.6.19 (China TST 1 2019/2)
Hence, pick a very large prime p satisfying p ≡ z (mod N ) and we get a contradiction.  The answer is yes. Take m > 1 such that mn ≡ 1 (mod n) (this can be done by choosing a
n
m such that m ≡ 1 (mod n)). Let d = m n−1 , and set

Solution 9.6.15 (IMO Shortlist 2005 N6) a1 = m, a2 = m(1 + d), a3 = m(1 + 2d), . . . an = m(1 + (n − 1)d)
n n n
The given condition gives a + n | b − a for all n. We cleverly pick n now given by the b1 = (1 + d), b2 = (1 + 2d), . . . bn−1 = (1 + (n − 1)d), bn = (1 + nd).
system of congruence (this has a solution by the Chinese Remainder Theorem)
( Then
n n−1 n n
n ≡ 0 (mod p − 1) Y Y Y Y
mn ·
ai = |{z} (1 + id) = (1 + id) = bi .
n ≡ −a (mod p) i=0 =(1+nd) i=0 i=0 i=0

for any prime p. By Fermat’s Little Theorem, such an n gives an ≡ a, bn ≡ b (mod p). Further, it is easy to check that the GCD of all terms is 1, and hence our construction works.
Further, an + n ≡ a + n ≡ 0 (mod p). Hence, p | bn − an implies a ≡ b (mod p). Since this Now we want to show there are infinitely many such sequences. However, this is true since
is true for all primes p, hence a = b. we have infinitely many choices for m. 

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 303 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 304
9. Constructions 9. Constructions

Solution 9.6.20 (INMO 2019/4) Now comes the main argument: Since pk+1 −1 < pk+1 , hence all its prime factors are from the
set {p1 , . . . , pk }, since these are the first k prime numbers. So we claim that N = Pk (pk+1 −1)
The key observation is that if z is any common divisor of M +i, M +j, then z | i−j implying
works.
z ≤ |i − j| ≤ n − 1. Now the following is the key claim:
Indeed, if pk+1 − 1 = pα1 1 . . . pαk k , then
Claim. Define
M +i ! ! !
xi = . Y Y Y
gcd(M + i, (n − 1)!) ϕ(Pk (pk+1 − 1)) = ϕ pαi i +1 = pαi i (pi − 1) = (pk+1 − 1)ϕ(Pk ) = ϕ(Pk+1 )
i i i
Then x1 , . . . , xn are all pairwise coprime.
Proof. Suppose p is a prime dividing both xi , xj . Then p | M + i, M + j and hence p ≤ n − 1. and we are done.
So even after dividing by the gcd if we have a leftover factor of p in xi , xj (with i 6= j), then

νp (M + i), νp (M + j) > νp ((n − 1)!) = w. Comment 9.6.8: If we want to explicitly see the numbers we get from the above
induction, we get
Then pw+1 | (M + i), (M + j) implies pw+1 ≤ n − 1. But this means pw+1 occurs in the
product (n − 1)!, which contradicts the fact that νp ((n − 1)!) = w < w + 1. n1 = (p1 − 1)p2 . . . pk
Now, since M > n n−1
> (n − 1)! for all n ≥ 1, all xi > 1, implying they have a prime n2 = p1 (p2 − 1) . . . pk
factor. So pick the set {pi } such that pi is any prime factor of xi . Clearly this works.  ...
nk = p1 p2 . . . (pk − 1).
Comment 9.6.7: Note that this proof improves the bound from M > nn−1 to M >
(n − 1)!. We present a second proof which is perhaps easier to come up with. All these numbers satisfy

ϕ(ni ) = ϕ(Pk ) = (p1 − 1)(p2 − 1) . . . (pk − 1).


Proof. Assume on the contrary. As before, if a number z divides two terms M + i, M + j,
then z ≤ n − 1. Now for numbers with at least n prime factors, we can pick a prime easily
for them. So ignore them for now.
Solution 9.6.22 (APMO 2020/4)
Suppose that M + i has less than n prime factors. Then since M + i > nn−1 , there exists
some prime factor p of M + i such that pα = pνp (M +i) > n. Pick this prime p for M + i. If p The answer is all linear polynomials. First, we show these work. Let P (x) = mx + n. Define
is also chosen for another M + j, then we must have also pβ = pνp (M +j) > n. However, then si = a1 + · · · + ai .
gcd(pα , pβ ) > n, contradicting the fact that any common divisor of M + i, M + j must be
Consider m + 1 numbers x1 , . . . , xm+1 > 1 that are all congruent to n (mod m). Then
less than n.
take the m+1 pairs sx1 −1 , sx2 −1 , . . . , sxm+1 −1 , . By the Pigeonhole Principle, two are the same
mod m, say sxi −1 , and sxj −1 . Then axi + axi +1 + · · · + axj −1 ≡ 0 (mod m), and hence
Solution 9.6.21 (USA TSTST 2015/5)
axi + axi +1 + · · · + axj ≡ axj ≡ n (mod m)
We show by induction on k that for any k, there exists an integer m such that ϕ(n) = m
has at least k solutions. The key idea is to take the first k primes 2 = p1 < p2 < · · · < pk . and so this works.
Claim. Let Pk denote the product p1 . . . pk . Then there exist at least k solutions to ϕ(n) = Now suppose deg P > 2. Then we will construct a sequence {ai } such that for any i < j,
ϕ(Pk ) such that all prime factors of n are from the set {p1 , . . . , pk }. there does not exist a k such that
Proof. For k = 1, the result is clearly true, so assume it till some k. Take any n such that
ai + ai+1 + · · · + aj = P (k).
ϕ(n) = ϕ(Pk ). Then ϕ(npk+1 ) = ϕ(n)ϕ(pk+1 ) = ϕ(Pk+1 ), since pk+1 ∤ n.
Hence, we have at least k solutions to ϕ(N ) = ϕ(Pk+1 ), and we just need 1 more. For We do this inductively, and suppose that you have added elements till ai . Let m be the integer
this, observe that of smallest magnitude that hasn’t occurred in the sequence yet. The key is to set ai+2 = m
ϕ(Pk+1 ) = (pk+1 − 1)ϕ(Pk ). (not ai+1 ). Now, any sum of consecutive terms containing ai+2 will have ai+1 . Hence, all

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 305 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 306
9. Constructions 9. Constructions

possible sums would be in a fixed vicinity around ai+1 , i.e. between I = (ai+1 − k, ai+1 + ℓ) Now, if {2, p1 , . . . , pk } are primes not sufficiently large, then take N = 4p1 p2 . . . pk and
for some fixed k, ℓ (since a1 , . . . , ai are fixed). set
Q(x) = N (2x2 − 1)2 .
Now we just want to choose an ai+1 such that no P (k) lies in I. Now, I has length k + ℓ.
However, since deg P ≥ 2, hence P (x + 1) − P (x) depends on x (unlike the case deg = 1) This works for n = 4, p1 , . . . , pk . Now for a composite number n, take any prime factor p of
and hence grows arbitrarily large. So, eventually there would exist an interval of length k + ℓ n. Then since polynomials are periodic mod p, hence we find at most 0.499p residues mod
which is completely skipped by P, i.e. no value in the interval would be of the form P (k) for p. This gives the result for n too.
an integer k. So we choose ai+1 so that I becomes this interval. 

Comment 9.6.9: The fact that each integer appears in the sequence is guaranteed by
the fact that we are choosing the smallest magnitude integer not yet in the sequence.
Since ai can be arbitrary and we want each integer to appear exactly once (a weird
condition), it’s better to construct it inductively step by step rather than, say, find a
nice formula for an .

Solution 9.6.23 (USA TSTST 2016/3)


Firstly, suppose n is a sufficiently large prime p > 2 (we define ”sufficient” later). Pick

Q(x) = (2x2 − 1)2 .

Now, consider the list L numbers 0, 1, . . . , p − 1 and delete a number x if Q(x) ≡ Q(x0 ) for
some x0 < x (i.e. the residue has appeared before). Since Q(a) ≡ Q(−a), the second half is
completely erased, meaning we only have the numbers 0, 1, . . . , (p − 1)/2 in L. We need to
show more numbers are deleted here so that at most 0.499p numbers remain.
We do this by using that fact that x2 ≡ y 2 is also possible when x ≡ −y. Hence,
Q(a) ≡ Q(b) also holds when

2a2 − 1 ≡ 1 − 2b2 (mod p) ⇐⇒ a2 + b2 ≡ 1 (mod p). (9.6)


p−1
By Theorem 8.5.1, we know this has p − (−1) 2
≥ p − 1 solutions. However, we only
need to consider pairs (a, b) such that a, b aren’t already erased, so we have to consider
0 ≤ a < b ≤ p−1
2
. So we need to remove some of the p − 1 solutions.
If (a, b) 6= (0, ±1), (±1, 0) is a solution to Equation 9.6, then so are (±a, ±b), (±b, ±a).
Further, at most one solution will have a ≡ b which is counted four times (as (±a, ±a)).
Hence, the number of repeated residues in L becomes ≥ (p−1)−4−4 8
= p−1
8
− 1. Hence, the
number of numbers remaining in L is

p+1 p−1 3p 13
− +1= + .
2 8 8 8
For sufficiently large p, this quantity becomes at most 0.499p, and so we are done in the case
n = p for ”sufficiently large” primes p.

c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 307 c
Aditya Khurmi 2020. All rights reserved. (Published on 11/2020) 308

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy