Number Theory
Number Theory
Number Theory
Course : RMO
Number Theory
Divisibility
For integers a and b, we say that a divides b, or that a is a divisor (or
factor) of b, or that b is a multiple of a, if there exists an integer c such that b =ca, and we denote this by
a | b. Otherwise, a does not divide b, and
we denote this by a b. A positive integer p is a prime if the only divisors of
p are 1 and p. If pk | a and pk+1 | a where p is a prime, i.e. pk is the highest
power of p dividing a, then we denote this by pk || a.
Useful Facts
• If a, b > 0, and a | b, then a ≤ b.
Theorem 1.1. The Division Algorithm. For any positive integer a and integer b, there exist unique integers q
and r such that b = qa + r and 0 ≤ r < a, with r = 0 iff a | b.
Theorem 1.2. The Fundamental Theorem of Arithmetic. Every integer greater than 1 can be written uniquely in
the form p1e1 p e22 .....p kek
where the pi are distinct primes and the ei are positive integers.
Theorem 1.3. (Euclid) There exist an infinite number of primes.
Proof. Suppose that there are a finite number of primes, say p1, p2, . . . , pn. let N = p1 p2 · · ·pn+1
By the fundamental theorem of arithmetic, N is divisible by some prime p. This prime p must be among the pi,
since by assumption these are all the primes, but N is seen not to be divisible by any of the pi contradiction.
Useful Facts
• Bertrand’s Postulate. For every positive integer n, there exists a prime p such that
n ≤ p ≤ 2n.
• Gauss’s Lemma. If a polynomial with integer coefficients factors into two polynomials with
rational coefficients, then it factors into two poly- nomials with integer coefficients.
Problems
Let a, b, and c denote three distinct integers, and let P denote a poly- nomial having all integral
coefficients. Show that it is impossible that P (a) = b, P (b) = c, and P (c) = a.
• For all a, b, and m, gcd(ma, mb) = m gcd(a, b) and lcm(ma, mb) = mlcm(a, b).
a b gcd(a, b)
gcd ,
d d d
In particular, if d = gcd(a, b), then gcd(a/d, b/d) = 1; that is, a/d and b/d are relatively prime.
• If a | bc and gcd(a, c) = 1, then a | b.
Proof. Let S be the set of all integers of the form ax+by, and let d be the least positive element of S. By the
division algorithm, there exist integers q
and r such that a = qd + r, 0 ≤ r < d. Then r = a qd = a q(ax + by) = (1 qx)a (qy)b, so r is
also in S. But r < d, so r = 0 ⇒ d | a, and similarly, d | b, so d | gcd(a, b). However, gcd(a, b) divides all
elements of S, so in particular gcd(a,b) |d ⇒ d = gcd(a,b). The second part of the theorem
follows.
Corollary 2.1. The positive integers a and b are relatively prime iff there exist integers x and y such that ax
+ by = 1.
Corollary 2.2. For any positive integers a1, a2, . . . , an, there exist integers x1, x2, . . . , xn, such that a1 x
+ a2x2 +· · ·+an xn = gcd(a1, a2, . . . , an).
Corollary 2.3. Let a and b be positive integers, and let n be an integer. Then the equation
ax + by = n
has a solution in integers x and y iff gcd(a,b) | n. If this is the case, then all solutions are of the form
x, y x 0 t. d , a
y 0 t.
d d
where d = gcd(a, b), (x0, y0) is a specific solution of ax + by = n, and t is an integer.
Proof. The first part follows from Theorem 2.1. For the second part, as stated, let
d = gcd(a, b), and let (x0, y0) be a specific solution of ax + by = n,
So that ax0 + by0 = n. If ax + by = n, then ax + by ax0 by0 = a(x x0) + b(y y0) = 0, or a(x x0) =
3 Arithmetic Functions
There are several important arithmetic functions, of which three are pre-sented here. If the
prime factorization of n > 1 is p1e1 p e2 2 ......pkek , then the number of positive integers less
than n, relatively prime to n, the number of divisors of n is
1 1 1
n 1 1 ....1
n
p1 p 2 p k
p1e1 1 p 2e2 1....p kek 1 p1 1p 2 1....p k 1
the number of divisors of n is
(n) = (e1 + 1) (e2 + 1)….(ek+1),
and the sum of the divisors of n is
n p1e1 p1e1 1 .... 1 p e22 p 2e2 1 .... 1 …. p ekk p kek 1 .... 1
p e1 1
1 p e 2 1
1 p ek 1 1
= 1 2 ...... k
p1 1 p 2 1 p 1
k
Also, (1), (1), and σ(1) are defined to be 1. We say that a function f is multiplicative
if f (mn) = f (m) f (n) for all relatively prime positive integers m and n, and f (1) =1
(otherwise, f (1) = 0, which implies that f (n) = 0 for all n).
4 Modular Arithmetic
For a positive integer m and integers a and b, we say that a is congruent to b modulo m
if m | (a – b), and we denote this by a ≡ b modulo m, or more commonly a ≡ b (mod m).
Otherwise, a is not congruent to b modulo m, and we denote this by a b (mod m)
(although this notation is not used often). In the above notation, m is called the modulus,
and we consider the integers modulo m.
= bd + (dk + bl + km)m,
so ac ≡ bd (mod m)
Useful Facts
• For all integers n,
0 if n is even,
n2 mod 4
1
if n is od.
• For all integers n,
0 if n 0 (mod 4)
n 4mod 8 if n 2 (mod 4)
2
1 if n 1 (mod 2)
• If f is a polynomial with integer coefficients and a ≡ b (mod m), then
f(a) ≡ f(b) (mod m).
Theorem 4.1. The inverse of a modulo m exists and is unique iff a is relatively prime to m.
Proof. If ax ≡ 1 (mod m), then ax = 1 + km for some k ⇒ ax km = 1. By Corollary 2.2, a and
m are relatively prime. Now, if gcd(a, m) = 1, then by Corollary 2.2, there exist integers x and y
such that ax + my = 1 ⇒ ax = 1 my ⇒ ax ≡ 1 (mod m). The inverse x is unique modulo m,
since if x is also an inverse, then ax ≡ ax ≡ 1 ⇒ xax ≡ xax ≡ x ≡ x
Corollary 4.2. If p is a prime, then the inverse of a modulo p exists and is unique iff p does not
divide a.
Corollary 4.3. If ak ≡ bk (mod m) and k is relatively prime to m, then
a ≡b (mod m).
–1
Proof. Multiplying both sides by k , which exists by Theorem 4.2, yields the result.
We say that a set {a1, a2, . . . , am} is a complete residue system modulo
m if for all i, 0 ≤ i ≤ m1, there exists a unique j such that aj ≡ i (mod m).
Theorem 4.4. Euler’s Theorem. If a is relatively prime to m, then a(m) 1 (mod m).
Proof. Let a1, a2, . . . , a(m) be the positive integers less than m that are relatively prime to m.
Consider the integers aa1, aa2, . . . , aa(m). We claim that they are a permutation of the original (m)
integers ai, modulo m. For each i, aai is also relatively prime to m, so aai ≡ ak for some k. Since aai ≡
aaj ⇔ ai ≡ aj (mod m), each ai gets taken to a different ak under
multiplication by a, so indeed they are permuted. Hence,
a(m)a1a2 · · · a(m)
Remark. We immediately have that (p 1)! ≡ Sp–1 ≡ 1 (mod p), which is Wilson’s Theorem. Also,
xp x ≡ 0 (mod p) for all x, yet we cannot compare coefficients here. Why not?
2
Theorem 4.6. If p is a prime and n is an integer such that p | (4n + 1), then p ≡ 1 (mod 4).
Proof. Clearly, p cannot be 2, so we need only show that p ≡ 3 (mod 4).Suppose p = 4k + 3 for some k.
p−1
Let y = 2n, so by Fermat’s Little Theorem, y ≡ 1 (mod p), since p does not divide n. But, y2 + 1 ≡ 0,
so
yp−1 ≡ y4k+2 ≡ (y2)2k+1 ≡ (1)2k+1 ≡ 1 (mod p),
Theorem 4.7.Wilson’s Theorem. If p is a prime, then (p 1)! ≡ 1 (mod p). (See also Example 4.5.)
Proof. Consider the congruence x ≡ 1 (mod p). Then x 1≡(x1)(x +1)≡0, so the only solutions are x ≡
2 2
(p 1)! ≡ 1 · 2 · · · (p 2)·(p 1)
≡ 1 · 1 · · · 1 · (p 1)
≡ 1 (mod p).
EXERCISE
2 2
1. Find all positive integers d such that d divides both n + 1 and (n + 1) + 1 for some integer n.
2. Prove that there are infinitely many positive integers n such that n(n + 1) can be expressed as a sum of
two positive squares in at least two different ways. (Here a2 + b2 and b2 + a2 are considered as the same
representation.) [RMO-2006]
3. Let a, b, c be three natural numbers such that a < b < c and gcd(c – a, c – b) = 1. Suppose there exists
an integer d such that a + d, b + d, c + d form the sides of a right-angled triangle. Prove that there exist
integers, l, m such that c + d = l2 + m2. [RMO-2007]
5. A natural number n is chosen strictly between two consecutive perfect square. The smaller of these
two squares is obtained by subtracting k from n and the larger one is obtained by adding to n. Prove
that n – k is a perfect square. [RMO-2011]
6. Prove that for all positive integers n, 169 divides 21n2 + 89n + 44 if 13 divides n2 + 3n + 51. [RMO-2012]
1 2 3
7. Determine with proof all triples (a, b, c) of positive integers satisfying + + = 1, where a is a
a b c
prime number and a b c. [RMO-2012]
8. Find all triples (p, q, r) of primes such that pq = r + 1 and 2(p2 + q2) = r2 + 1. [RMO-2013]
and
10. Let 0 < a1 < a2 < · · · < amn+1 be mn + 1 integers. Prove that you can select either m + 1 of them no
one of which divides any other, or n + 1 of them each dividing the following one.
11. For a positive integer n, let r(n) denote the sum of the remainders when n is divided by
1, 2, . . . , n respectively. Prove that r(k) = r(k 1) for infinitely many positive integers k.
12. The positive integers a1, a2, . . . , an are such that each is less than 1000, and lcm
(ai, aj) > 1000 for all i, j, i = j. Show that
n
1
a
i1 i
2
13. Find all solutions to aabb = n4 − 6n3, where a and b are non-zero digits, and n is an integer