0% found this document useful (0 votes)
21 views31 pages

2 Number Theory

This document is an introductory essay on number theory, covering topics such as divisibility, prime numbers, and congruences, structured into eight chapters. Each chapter includes essential definitions, theorems, and a range of problems, along with hints and solutions provided at the end. The essay aims to enhance understanding of number theory and prepare readers for mathematical competitions, while noting that some related topics, like Diophantine equations, are excluded for brevity.

Uploaded by

kadiira305
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views31 pages

2 Number Theory

This document is an introductory essay on number theory, covering topics such as divisibility, prime numbers, and congruences, structured into eight chapters. Each chapter includes essential definitions, theorems, and a range of problems, along with hints and solutions provided at the end. The essay aims to enhance understanding of number theory and prepare readers for mathematical competitions, while noting that some related topics, like Diophantine equations, are excluded for brevity.

Uploaded by

kadiira305
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

TOPICS IN NUMBER THEORY

Valentin Goranko

1
Topics in Number Theory
This essay is an introduction to some basic topics in number theory related to divisibility, prime numbers
and congruences. These topics are sources of numerous elementary (but often far from simple) problems
which traditionally appear in all advanced mathematical competitions, in particular the International
Mathematical Olympiad.
The articles is divided into 8 chapters each presenting a minimum of necessary background, i.e. basic
definitions, facts and theorems which can themselves be regarded as interesting problems. Every chapter
ends with a number of problems ranging from elementary to quite advanced ones, many of which have
been given at various competitions and Olympiads. Hints and solutions to these problems are given at
the end of the article and a number of additional problems are included.
No special knowledge outside school curriculum is required as a prerequisite to this article, but a
good deal of mathematical inclination and persistence are necessary for successful work with it. The
reward of the work done will be twofold: intellectual — the feeling of a contact with a beautiful piece
of mathematics, and practical — the confidence to know how to approach and cope with a large variety
of problems in number theory. Of course, due to limitations of space, some interesting related topics
traditionally covered by mathematical competitions are left untouched in this essay, perhaps the most
important being Diophantine equations which will be the topic of another essay.
Here is the content of the article:
• Introduction: induction.
Ch. 1 Divisibility: basic properties. Division with a remainder.
Ch. 2 Greatest common divisor. Euclid’s algorithm.

Ch. 3 Relatively prime numbers.


Ch. 4 Least common multiple.
Ch. 5 Prime numbers. Fundamental theorem of arithmetic.

Ch. 6 Congruences.
Ch. 7 Euler’s function. Euler’s and Fermat’s theorems.
Ch. 8 Linear congruences and Chinese Remainder Theorem.
• Hints and solutions

• Additional problems.

Introduction: induction
Number theory is one of the most important and oldest branches of mathematics and is concerned with
the properties of the natural numbers, or positive integers 1, 2, 3, 4, . . .. (Sometimes 0 is also regarded as
a natural number, but we shall keep it apart.) We shall denote the set of natural numbers by N.
A fundamental property of the set of natural numbers, which we take for granted, is the following:
Every non-empty collection of natural numbers has a least element.

The most common method for proving facts about natural numbers is the principle of mathematical
induction, a popular form of which is:
If
some assertion P about natural numbers holds for 1
and
whenever P holds for some natural number n, then P holds for n + 1 too,
then
P holds for every natural number.

2
Indeed, assume that there are natural numbers for which P does not hold. The collection of such numbers
has a least element m. It must be greater than 1 since P holds for 1. Therefore m − 1 is a number less
than m, hence P holds for m − 1. But then P must hold for m, since m = (m − 1) + 1, which is not
the case. Thus we have fallen into an absurd situation: the statement “P holds for M ” is both false and
true. The only way to escape from this absurd is to agree that our assumption was wrong. Thus, there
are no natural numbers for which P does not hold, that it, P holds for all natural number.
The trick used in the above argument is called proof by contradiction. It is a very useful and powerful
method for (not only) mathematical reasoning and will be often applied further.
As a typical application of the principle of mathematical induction we shall prove the following fact:

For every natural number n,


n(n + 1)
1 + 2 + ··· + n = . (1)
2
First we verify (1) for n = 1: 1 = 1(1+1)
2 .
Then we have to show that whenever P holds for some natural number n, P holds for n + 1, too. In
order to show this we assume that (1) holds for some natural number n. This assumption is called the
inductive hypothesis. Now, using this assumption, we have to show that (1) holds for n + 1. Here it goes:
1 + 2 + · · · + (n + 1) = (1 + 2 + · · · + n) + (n + 1)
n(n + 1)
= + (n + 1)
2
n(n + 1) + 2(n + 1)
=
2
(n + 1)(n + 2)
= .
2
Thus we have shown that the conditions of the principle of induction hold for (1) and therefore, (1) holds
for every natural number n.

A seemingly stronger but in fact equivalent form of the principle of mathematical induction reads:
If
for every natural number n, the assumption that an assertion P holds for every natural number m < n
leads to the conclusion that P holds for n itself,
then
P holds for every natural number n.

Exercise. Prove this principle, using a similar argument to the previous one.

1 Divisibility: basic properties.


Division with a remainder
When we deal with divisibility of numbers it is convenient to consider not only the natural numbers, but
all integers
. . . , −2, −1, 0, 1, 2, . . . .
Here is the basic definition: A non-zero integer a divides an integer b if there is an integer x such that
b = ax.
If a divides b we write a | b and also say that b is divisible by a, or a is a divisor of b, or b is a multiple
of a.
Is a does not divide b we write a - b.
For instance 3 | 15 and −3 | 15, but 3 - 16, −3 - 16 and 4 - 15.
Hereafter, whenever we write a | b, a is assumed non-zero.
Here are some basic properties of divisibility:

3
(D1) 1 | b for any integer b;
(D2) a | 0 and a | a for any non-zero integer a;
(D3) If a | b, then −a | b and a | −b;
(D4) If a | b then a | bc for any integer c;
(D5) If a | b and b | c, then a | c;
(D6) If a | b and a | c, then a | (mb + nc) for any integers m and n. In particular, a | b − c and a | b + c;
(D7) If a | b and b | a, then a = b or a = −b. In particular, if a and b are natural numbers, then a = b;
(D8) If a | b and a, b > 0, then a ≤ b;
(D9) If m is a non-zero integer then a | b if and only if ma | mb;
(D10) If a | b and c | d, then ac | bd.
All of these properties are immediate consequences of the definition. Let us show for instance (D6).
Let a | b and a | c. Then b = xa for some integer x and c = ya for some integer y. Then mb + nc =
mxa + nya = (mx + ny)a, hence a | (mb + nc).
A frequently used fact, which follows from (D6) is that if a | b and a | b + c, then a | c since
c = (b + c) − b; and likewise, if a | b and a | b − c, then a | c since c = b − (b − c).
Exercise. Verify all other properties listed above.

The following is a fundamental theorem about division of integers.


Theorem 1.1. Given any integers a > 0 and b, there exist unique integers q and r such that

b = qa + r and 0 ≤ r < a.

Furthermore, r = 0 if and only if a | b.


Proof. If b = 0, then b = 0 · a + b and b < a. Suppose that b 6= 0. Consider the arithmetic sequence
. . . , b − 2a, b − a, b, b + a, b + 2a, . . .. Notice that 0 belongs to this sequence if and only if b = qa for
some integer q, i.e. if and only if a | b. Now, suppose that a - b, hence no term of the sequence is zero.
There are positive terms in the sequence (show this!); let r = b − qa be the least of them. It exists
due to the fundamental property of the natural numbers, discussed in the introduction. We claim that
r < a. Indeed, if r ≥ a, then r − a ≥ 0 and r − a = (b − qa) − a = b − (q + 1)a, so r − a belongs to the
sequence too. Furthermore, r − a is less than r, which contradicts the choice of r. Thus 0 < r < a, so we
have proved the existence of r and q with the desired properties. Now let us show that they are unique.
Suppose that there are two pairs (q1 , r1 ) and (q2 , r2 ) satisfying the conditions of the theorem and assume
r1 ≥ r2 . Then r2 − r1 = (b − q1 a) − (b − q2 a) = (q2 − q1 )a. On the other hand 0 ≤ r1 − r2 < a, which
leaves the only possibility for q2 − q1 to be 0, i.e. q1 = q2 from where r1 = r2 .
Finally, if r = 0 then a | b by definition. Conversely, if a | b then a = kb + 0 for some integer k. Then,
by uniqueness of q and r, q must equal k and r must be 0.
The numbers q and r from the above theorem are called, respectively, the quotient and the remainder
of the division of b by a. Thus, the theorem says that every integer b can be divided with remainder by
any natural number a in a unique way.

Problems
1.1. Show that every non-zero integer a has only finitely many divisors.
1.2. How many integers between 100 and 100 are divisible by 11?
1.3. Prove that for any integer n the remainder of the division of n2 by 4 is either 0 or 1.
1.4. A right-angled triangle has sides with integer lengths. Show that

4
(a) the length of one of the two shorter sides of the triangle is divisible by 3;
(b) the length of one of the sides of the triangle is divisible by 5.
1.5. Show that for any natural number n represented in decimal system, n is divisible by

(a) 2 if and only if its last digit is divisible by 2;


(b) 4 if and only if the number formed by its last two digits is divisible by 4;
(c) 5 if and only if its last digit is divisible by 5.
1.6. Prove that for every natural number n

(a) if n is odd then 8 | n2 − 1;


(b) 8 | 32n − 1;
(c) 9 | 4n + 15n − 1.
1.7. Show that for any natural numbers n and m the following sums are not integers.
1 1
(a) N1 = 2 + 3 + · · · + n1 ;
1 1 1
(b) N2 = n + n+1 + · · · + n+m ;
1 1 1
(c) N3 = 3 + 5 + · · · + 2n+1 .

1.8. Prove that if m | abn + cn + d for every integer n ≥ 0, then m | c2 .


1.9. If m is a natural number greater than 1, show that every natural number N , can be uniquely
represented in the form
N = c0 + c1 m + c2 m2 + · · · + ck mk ,
(when k = 0, N = c0 ) where the coefficients ci are integers satisfying the conditions 0 ≤ ci < m
(i = 0, 1, . . . , k − 1), 0 < ck < m.
This statement means that every natural number can be uniquely represented in a number system
with base m for every natural number m > 1.

2 Greatest common divisor


An integer d is a common divisor of the integers a and b if d | a and d | b. The greatest integer amongst
the common divisors of a and b (if it exists) is called the greatest common divisor of a and b, denoted
gcd(a, b) or simply (a, b).
Note that (a, b) is always positive: if c is a common divisor of a and b and c is negative, then −c is
also a common divisor of a and b, and is greater than c.
Now we shall derive the most important facts about the greatest common divisor.
Theorem 2.1. If a and b are integers, at least one of them non-zero, then

(i) (a, b) exists;


(ii) (a, b) = ua + vb for some integers u and v. Moreover, (a, b) is the least positive integer which can
be represented in this way.
Proof. (i) It follows from exercise 1.1 that, unless a = b = 0, a and b have finitely many common
divisors, hence there is a greatest among them.
(ii) Consider the set L of all linear combinations xa + yb where x and y range over all integers. There
are positive values in L (why?). Let d = ua + vb be the least positive integer in L. (Here we apply
again the fundamental property of the natural numbers.) We shall show that d | a and d | b.
Suppose d - a. Then, by Theorem 1.1, there are integers q and r such that a = dq +r and 0 < r < d.
Hence we have
r = a − qd = a − q(ua + vb) = (1 − qu)a + (qv)b

5
and thus r belongs to L, which is impossible since r is a positive integer less than d. Therefore
d | a. Likewise d | b. Thus d is a common divisor of a and b. Let g = (a, b). Then a = ga0 and
b = gb0 , hence d = (ga0 )u + (gb0 )v = g(a0 u + b0 v). Thus g | d, hence g ≤ d by (D8), and d ≤ g by
definition of g. Therefore g = d.

Theorem 2.2. If the integers a and b have a greatest common divisor (a, b) then every common divisor
of a and b divides (a, b).
Proof. By Theorem 2.1, (a, b) = ua+vb for some integers u and v. Now, if d | a and d | b, then d | ua+vb,
by property (D6).

Here are some basic properties of the greatest common divisor.


(GCD1) (a, b) = (b, a);
(GCD2) If a | b then (a, b) = |a|;

(GCD3) If a = 0 and b 6= 0, then (a, b) = |b|;


(GCD4) (a, b) = (a, −b) = (−a, b) = (−a, −b);
(GCD5) For any integer c, (a, b) = (a, b + ac) = (a + bc, b);
(GCD6) For any integer m, (ma, mb) = |m| (a, b);

(GCD7) If d | a and d | b then ad , db = (a,b) a b


 
d . In particular, if d = (a, b), then d, d = 1;
(GCD8) ((a, b), c) = (a, (b, c)) for any integers a, b, c.
We shall verify (GCD5), (GCD6) and (GCD7); the rest are left as exercises.

(GCD5) Let g = (a, b), h = (a, b + ac). Then g | b + ac by (D6), hence g | h by Theorem 2.2. On the
other hand, for some integers u and v, g = au + bv = a((u − cv) + (b + ac)v). Thus h | g by (D6).
Therefore g = h by (D6) since g and h are both positive. Likewise (a, b) = (a + bc, b).

(GCD6) We can assume that m > 0, otherwise we take −m and apply (GCD4). Now, (ma, mb) = the
least positive value of max + mby where x and y are integers = m times the least positive value of
ax + by where x and y are integers = m(a, b).
(GCD7) Again we can assume that d > 0. Let g = ad , db and h = (a, b). Then a = da0 , b = db0 and, by


(GCD6), h = d(a0 , b0 ) = dg, hence g = hd .

The definition of greatest common divisor is easily generalized to several integers. We denote the
greatest common divisor of the integers a1 , . . . , ak by (a1 , . . . , ak ).
Exercise. Show that (a1 , a2 , a3 ) = (a1 , (a2 , a3 )), . . . , (a1 , a2 , . . . , ak ) = (a1 , (a2 , . . . , ak )). Furthermore,
show that if b1 , b2 , . . . , bk is a rearrangement of a1 , a2 , . . . , ak , then (b1 , b2 , . . . , bk ) = (a1 , a2 , . . . , ak ).
Hint: use properties (GCD1) and (GCD8).

It is not difficult to see that Theorem 2.1 and Theorem 2.2 can be generalized for greatest common
divisors of several integers:
(1) If a1 , a2 , . . . , ak are not all zero then (a1 , a2 , . . . , ak ) exists and equals the least positive integer
which can be represented as a linear combination of a1 , a2 , . . . , ak : (a1 , a2 , . . . , ak ) = u1 a1 + u2 a2 +
· · · + uk ak for some integers u1 , u2 , . . . , uk .
(2) Every common divisor of a1 , a2 , . . . , ak divides (a1 , a2 , . . . , ak ).

6
Exercise. Prove these statements for three integers.

Now we know many properties of the greatest common divisor of two integers, but still the main
question remains: how to compute it? Due to properties (GCD1), (GCD3) and (GCD4) we see that it
is sufficient to ba able to compute the greatest common divisor of natural numbers; then we can do so
for any integers. For instance (123, −321) = (123, 321).
Theorem 2.3. Let a and b be natural numbers. The following procedure computes the greatest common
divisor of a and b.
1. Denote by X the greater of a and b, and by Y the smaller one; if a = b then X = Y = a.
2. Divide X by Y with a remainder: X = QY + R, where 0 ≤ R ≤ Y .
3. If R = 0, then (a, b) = Y and the procedure ends. If not, continue with 4.
4. If R > 0 replace X by Y and then Y by R, and go back to step 2.
This simple and elegant procedure was invented by Euclid, the celebrated mathematician of ancient
Greece who laid the sound foundations not only of the geometry, but of number theory as well. This
procedure was perhaps one of the first and most famous instances of what is nowadays called the algo-
rithm.

Before we show why this algorithm works, let us see how it works on a particular example.
Example. Find (30, 102) using the Euclidean algorithm. We follow the procedure:

1. Set X to be 102 and Y to be 30.


2. Divide X by Y with a remainder: 102 = 3 · 30 + 12.
3. The remainder is not 0, hence continue with 4.
4. X becomes 30 and Y becomes 12; the go back to 2.
2. Divide X by Y with a remainder: 30 = 2 · 12 + 6.
3. The remainder is not 0, hence continue with 4.
4. X becomes 12 and Y becomes 6; then go back to 2.
2. Divide X by Y with a remainder:
3. The remainder is 0, hence (30, 102) = Y = 6.
• End of procedure.

Now let us prove that the Euclidean algorithm works. We must check two things:
1. That, for any two natural numbers, if the procedure ends the result is indeed their greatest common
divisor.
2. That for any two natural numbers the procedure ends.
To say it in terms of computer science, we must verify the correctness of the algorithm. Here it is:
1. Let us first observe that at any stage of the execution of the algorithm, (X, Y ) remains equal
to (a, b). (As a computer scientist would say, (X, Y ) is an invariant of the algorithm.) At the
beginning this is trivially so. The only changes of the values of X and Y occur at point 4. There
the pair (X, Y ) is replaced by Y, R, where R = X − QY is the remainder of the division of X by
Y . Hence we only have to check that

(X, Y ) = (Y, X − QY )

7
which easily follows from (GCD5) and (GCD1).
Thus (X, Y ) is always equal to (a, b). It remains to show that whenever the procedure ends, the
result is what we need. The procedure ends only if the remainder R becomes 0, that is, the values
of X and Y become such that Y | X. Then the result is Y , which is indeed (X, Y ), due to (GCD2).
The first task is completed.
2. Suppose that for some natural numbers a, b the procedure never ends. This can only happen if the
point 4 (the only one which sends the execution back) is executed infinitely many times. Let us
notice two things:
• each time when point 4 is executed, the value of X strictly diminishes, being replaced by Y
(for, X ≥ Y and if X = Y , then R would be 0).
• the values of X and Y always remain natural numbers.
Thus, the consecutive values of X form an infinite strictly decreasing sequence of natural numbers.
Due to the fundamental property of the natural numbers, this is impossible because the collection
of the terms of such a sequence has no least element.
Therefore the procedure must terminate.
In the long run, we have established the correctness of Euclid’s algorithm.

Exercise. Using the Euclidean algorithm, find:


(a)(70, 112) (b)(258, 801) (c)(7469, 2464) (d)(2689, 4001).

Problems
2.1. Given that (a, 4) = 2 and (b, 4) = 2, show that (a + b, 4) = 4.
2.2. Let x and y be integers such that x + y = 1000. Is it possible that (x, y) = 3?
2.3. Prove that for any integers a and b, (a, b) = (3a + 5b, 11a + 18b).
21n+4
2.4. Prove that the fraction 14n+3 is irreducible for any natural n.
This was Problem 1 from the First International Mathematical Olympiad (IMO) in Romania, 1959.
2.5. Let a, b, c, A, B, C be integers such that (a, b) = c and (A, B) = C. Show that (aA, aB, Ab, AB) =
cC.
n
2.6. Let k be any natural number and an = k 2 + 1. Show that if m 6= n, then (am , an ) = 1 if k is even,
otherwise (am , an ) = 2.
2.7. Let a > 1 and m be natural numbers. Show that
 m 
a −1
, a − 1 = (a − 1, m).
a−1

2.8. If a, m, n are natural numbers, a > 1 and (m, n) = d, show that


(am − 1, an − 1) = ad − 1.

3 Relatively prime numbers


Natural numbers a and b are called relatively prime if
(a, b) = 1.

Example. 8 and 15 are relatively prime, 8 and 14 are not.


The following theorem will summarize those properties of relatively prime numbers which will be
used further on.

8
Theorem 3.1. For all integers a, b and c:
(1) If c | ab and (c, a) = 1, then c | b.
(2) If (a, b) = 1, then (a, bc) = (a, c).
(3) (a, bc) = 1 if and only if (a, b) = 1 and (a, c) = 1.
(4) If (a, b) = 1, then ab | c if and only if a | c and b | c.
Proof. (1) Assume that c | ab and (c, a) = 1. Then ab = kc for some integer k and 1 = uc + va for some
integers u and v. Multiplying the latter equality by b we get b = ubc+vab = ubc+vkc = (ub+vk)c,
hence c | b.
(2) Let (a, b) = 1, (a, bc) = d1 and (a, c) = d2 . Then obviously d2 | d1 . Conversely, d1 must be
relatively prime to b because d1 | a. Hence by (1), d1 | c since d1 | bc. Thus d1 | d2 and therefore
d1 = d2 .
(3) If (a, bc) = 1 then (a, b) = 1 and (a, c) = 1 since every divisor of (a, b) or (a, c) is a divisor of (a, bc).
Conversely, if (a, b) = 1 and (a, c) = 1 then by (2), (a, bc) = (a, c) = 1.
(4) If ab | c then a | c and b | c. Now, let (a, b) = 1 and suppose that a | c and b | c. Then c = ak for
some integer k and b | ak. Therefore, by (1), b | k hence ab | ak, i.e. ab | c.

Natural numbers a1 , . . . , an are said to be:


(i) relatively prime if (a1 , . . . , an ) = 1;
(ii) relatively prime in pairs if every two of them are relatively prime.
Obviously, if the integers a1 , . . . , an are relatively prime in pairs, then they are relatively prime. The
converse is not generally true (see Problem 3.1).

Problems
3.1. (a) Find three integers which are relatively rime but no two of them are relatively prime.
(b) Find four integers which are relatively prime but no three of them are relatively prime.
(c) Find four integers such that every three but no two of them are relatively prime.
3.2. Show that amongst any 5 consecutive integers there is at least one which is relatively prime to each
of the others.
3.3. Show that the product of every
(a) 3 consecutive integers is divisible by 6;
(b) 4 consecutive integers is divisible by 24;
(c) 5 consecutive integers is divisible by 120.
3.4. Prove that for every integer n
(a) 6 | n3 − n;
(b) 30 | n5 − n;
(c) 120 | n5 − 5n3 + 4n.
3.5. Show that the sequence {2n − 3|n = 2, 3, 4, . . .} contains infinitely many numbers relatively prime
in pairs.
This was Problem 3 from the 13th IMO in Czechoslovakia, 1971.
3.6. A sequence of natural numbers is defined by the equalities t1 = 2 and tn+1 = t2n − tn + 1 for n ≥ 0.
Show that if m 6= n, then (tm , tn ) = 1.

9
4 Least common multiple
An integer m is a common multiple of the non-zero integers a and b if a | m and b | m. The least positive
number amongst the common multiples of a and b, if it exists, is called the least common multiple of a
and b, denoted [a, b].

Let us observe that if a and b are non-zero, then [a, b] always exists. Indeed, the collection of positive
common multiples of a and b is non-empty, since |ab| belongs to it. Therefore, by the fundamental
property of the natural numbers, there is a least number in that collection.

Here are some basic properties of least common multiples.


(LCM1) [a, b] = [b, a].

(LCM2) if a | b then [a, b] = |b|.


(LCM3) [a, b] = [a, −b] = [−a, b] = [−a, −b].
(LCM4) [na, nb] = n[a, b].

(LCM5) [[a, b], c] = [a, [b, c]].

Exercise. Verify these properties.

We can likewise introduce a least common multiple of several integers a1 , a2 , . . . , ak . It is denoted by


[a1 , a2 , . . . , ak ].

Exercise. Show that [a1 , a2 , a3 ] = [a1 , [a2 , a3 ]], . . . , [a1 , a2 , . . . , ak ] = [a1 , [a2 , . . . , ak ]].
Theorem 4.1. The least common multiple of the non-zero integers a1 , a2 , . . . , ak is a divisor of every
one of their common multiples.

Proof. Let m = [a1 , a2 , . . . , ak ] and n be a common multiple of a1 , a2 , . . . , ak . Let us divide n by m with


remainder: n = mq + r, 0 ≤ r < m. Then r = n − mq = 1 · n + (−q) · m. Hence, by (D5), r must be a
common multiple of a1 , a2 , . . . , ak , less than m. Therefore r = 0, hence m | n.
Theorem 4.2. For every natural numbers a and b,
ab
(a, b) = .
[a, b]

Proof. Let g = (a, b), m = [a, b] and d = ab m m m m


m . Then a = b d and b = a d where b and a are integers.
Therefore d is a common divisor of a and b. By Theorem 2.2, d | g, i.e. g = dk for some positive integer
k. Then m m a b a b
k is a positive common multiple of a and b: k = g b = g a, where g and g are integers. Since
m
m is the least positive common multiple of a and b, it follows that m ≤ k which is possible only if k = 1.
Thus g = d, as was to be proved.

Exercise. Find the least common multiple of

(a)6 and 8(b)28 and 42(c)70 and 71(d)482 and 1687.

Problems
4.1. Let n be a natural number. Find [n, n + 1].
4.2. Let m and n be natural numbers such that (m, n) = [m, n]. Show that m = n.
4.3. Find all pairs of natural numbers m, n for which (m, n) = 10 and [m, n] = 100.

10
4.4. Prove that for any natural number n,

[1, 2, 3, . . . , 2n] = [n + 1, n + 2, . . . , 2n].

4.5. Prove that for any natural numbers m and n,

[1, 2, . . . , m, n, n + 1, . . . , n + m − 1] = [n, n + 1, . . . , n + m − 1].

5 Prime numbers. The fundamental theorem of arithmetic


A natural number p > 1 is called prime (or a prime number ) if it has exactly two natural divisors: 1
and p (called trivial divisors of p). Otherwise p is called a composite number.
Exercise. 2, 3, 5, 27, 101, 1993 are primes; 4, 189, 1001 are composite (show this); 1 is neither prime
nor composite (by definition).

Theorem 5.1. Every natural number greater than 1 has a prime divisor.
Proof. Assume the contrary: there are natural numbers greater than 1, without any prime divisors. Let
m be the least of them. Since m | m, m cannot be prime, hence it is composite, i.e. has a positive divisor
n, different from 1 and from m. Then 1 < n < m, hence n must have a prime divisor p. Thus p | n and
n | m, hence p | m which is a contradiction. Therefore there is no such m.

Remark. In fact, every composite number n has a prime divisor not greater √ than n. Indeed, let
n = n1 n2 . Then at least one of n1 and n2 , assume n1 , is not greater than n. Now, n1 has a prime
divisor which is of course not greater than n1 and is a divisor of n also.

Theorem 5.2 (Euclid, about 2350 years ago). There are infinitely many primes.
Proof. Assume the contrary: there are finitely many primes and let p1 , p2 , . . . , pk be all of them. Now
consider the number
N = p1 p2 · · · pk + 1.
Since N is greater than each of p1 , p2 , . . . , pk it must be composite. By the previous Theorem, N has a
prime divisor p which must be some of p1 , p2 , . . . , pk , for instance p = p1 . Then p1 | N and p1 | p1 p2 · · · pk
since p1 occurs as a factor in p1 p2 · · · pk . Hence, by (D6), p1 | N −p1 p2 · · · pk , i.e. p1 | 1 which is impossible
since every prime is greater than 1. Therefore we must conclude that there are infinitely many primes.
Theorem 5.3. (1) For every natural number a and a prime p, either p | a or (p, a) = 1.
(2) For very natural numbers a and b and a prime p, if p | ab then p divides at least one of a and b.
Proof. (1) (p, a) can only be either p or 1.

(2) If p - a then (p, a) = 1 hence, by Theorem 3.1 (1), p divides b.

Theorem 5.3 can easily be generalized by induction to

For all natural numbers a1 , . . . , ak and a prime p, if p | a1 a · · · ak then p divides at least one of
a1 , . . . , ak .

The notion of prime number is basic in number theory. As we shall see from the next theorem the
prime numbers are like “elementary particles” from which all natural numbers are built.

Theorem 5.4 (Fundamental theorem of arithmetic). Every natural number n > 1 can be decomposed
into a product of primes:
n = p1 · · · pk (k ≥ 1).
Moreover, this decomposition is unique up to the order of the factors.

11
Proof. We can reformulate the theorem as follows: for every natural number n, if n > 1 then n can be
decomposed. . . . Now we can apply the principle of mathematical induction. Assume that the theorem
is valid for all natural numbers m such that m < n. We must conclude that it is valid for n too. If
n = 1, nothing is claimed so that this case is trivially true. Now, let n > 1. Then n has prime divisors,
by Theorem 5.1. Let p1 be the least of them. Then n = p1 n1 and n1 < n. If n1 = 1 then n = p1 is
prime and this is the decomposition of n; it is unique since p1 cannot be expressed as a product of two
or more primes. Now, if 1 < n1 then, according to the inductive assumption, n1 is decomposed into a
product of primes: n1 = p2 · · · pk . Then we have a decomposition of n: n = p1 p2 · · · pk .
Suppose that besides this decomposition of n there is another one q1 · · · qm . Then

p1 · · · pk = q1 · · · qm .

Thus p1 | q1 · · · qm , hence p1 divides some of the factors q1 , . . . , qm . We may assume (possibly after
reordering) that p1 | q1 . This means that p1 = q1 since q1 is prime. Then we obtain

p2 · · · pk = q2 · · · qm .

Again, the inductive assumption holds for p2 · · · pk , so q2 , · · · qm must be a reordering of p2 , . . . , pk . Thus,


the theorem is valid for n.
Now we can conclude that the theorem is true for any natural number.
The above theorem can also be reformulated as follows:
Every natural number n > 1 can be decomposed into a product of powers of different primes:
αk
n = pα
1 · · · pk ,
2
α1 , . . . , αk , k ≥ 1.

Furthermore, this decomposition is unique up to the order of the factors.

An important topic in number theory is the distribution of prime numbers amongst the natural num-
bers. Perhaps it was the Greek mathematician Eratosthenes (circa 200 B.C.) who first introduced a
general method to single out the primes in the sequence of natural numbers using the so-called “Eratos-
thenes’s sieve”: in order to list all the prime numbers between 1 and n we take the sequence of all natural
numbers from 2 to n and cross out all multiples of 2 greater than 2, then all multiples of 3 greater
√ than
3, etc. until we have deleted all numbers divisible by any natural number not greater than n. The
remaining numbers are precisely the primes between 1 and n (recall the remark after Theorem 5.1).

Looking at the sequence of primes one can see that they are rather irregularly scattered amidst the
natural numbers. There are many (a hypothesis says infinitely many) so-called prime twins of the kind
p and p + 2. On the other hand there are arbitrarily large “gaps”, i.e. sequences of natural numbers
without any primes. An example of a sequence of k consecutive composite natural numbers, for any
natural number k, can be constructed as follows. We denote by n! the product 1 · 2 · · · (n − 1) · n. Now,
consider the numbers (k + 1)! + 2, . . . , (k + 1)! + k, (k + 1)! + (k + 1). They are all composite (why?). For
a stronger fact see Problem 5.11.

We shall give without proofs (which are too complicated to be discussed here) two important and
very useful facts about the distribution of primes. The first one was conjectures by Bertrand in 1845
and proved by Tchebychef in 1850:

Theorem 5.5 (Bertrand’s Postulate). For every integer n ≥ 4 there is at least one prime p such that
n < p < 2n − 2.
The second one is credited to Dirichlet:
Theorem 5.6 (Dirichlet’s Theorem on primes in arithmetic progressions). Every arithmetic progression
a, a + d, a + 2d, . . . where d > 0 and (a, d) = 1 contains infinitely many primes.

12
Problems
5.1. Without using Dirichlet’s Theorem 5.6 show that there are infinitely many primes of the form

(a) 4n + 3;
(b) 6n + 5.
5.2. (a) Show that if a prime is divided by 30 the remainder is either 1 or a prime.
(b) Is this true if 30 is replaced by 60?

5.3. If pn denotes the n-th prime in the sequence of natural numbers, prove the inequality
n
pn < 22 .

5.4. Prove that for every n > 2 there is a prime p such that n < p < n!.
5.5. Show that if the number 2p − 1 is prime, then p is a prime. (Prime numbers of the kind 2p − 1 are
called Mersenne primes).
5.6. Show that if the number 2n + 1 is a prime, then n is a power of 2. (Prime numbers of the kind
k
22 + 1 are called Fermat primes.)
5.7. A natural number m is called perfect if it equals the sum of its proper positive divisors (i.e. all
positive divisors of m excluding m itself). For example 6 = 1 + 2 + 3 and 28 = 1 + 2 + 4 + 7 + 14
are perfect numbers.
Prove the following theorem (Euclid, Elementa, Book 9 ):
If 2m − 1 is a prime then 2m−1 (2m − 1) is a perfect number.
αk β1 βk
5.8. Let n = pα 1 · · · pk and m = p1 · · · pk be decompositions of m and n in products of primes, where
1

p1 , p2 , . . . , pk are different primes and some of the α’s and β’s can be 0.
(a) Show that n | m if and only if α1 ≤ β1 , . . ., αk ≤ βk .
(b) Denote min(αi , βi ) (the minimum of αi and βi ) by γi and max(αi , βi ) (the maximum of αi
and βi ) by δi , for i = 1, . . . , k. Then show that

(m, n) = pγ11 · · · pγkk and [m, n] = pδ11 · · · pδkk .

For example, if n = 9800 = 23 · 52 · 72 and m = 14742 = 2 · 34 · 7 · 13 then we can represent tham


as n = 23 · 30 · 52 · 72 · 130 and m = 21 · 34 · 50 · 71 · 131 , hence (m, n) = 21 · 30 · 50 · 71 · 130 = 14
and [m, n] = 23 · 34 · 52 · 72 · 131 = 10319400.

5.9. Using Problem 5.8 prove the following identities for any natural numbers a, b, c:
(a) (a, [b, c]) = [(a, b), (a, c)];
(b) [a, (b, c)] = ([a, b], [a, c]);
(c) [(a, b), (b, c), (c, a)] = ([a, b], [b, c], [c, a]);
abc
(d) [a, b, c] = ;
(ab, bc, ca)
[a, b, c]2 (a, b, c)2
(e) = .
[a, b][b, c][c, a] (a, b)(b, c)(c, a)
M
5.10. Let m1 , . . . , mk be natural numbers, M = m1 · · · mk and Mi = m i
, for i = 1, 2, . . . , n. Prove that
m1 , . . . , mn are relatively prime in pairs if and only if (M1 , M2 , . . . , Mn ) = 1.
5.11. Let n and k ≥ 2 be natural numbers. Show that there exist n consecutive natural numbers each of
which can be factorized in a product of at least k prime divisors (not necessarily different).

13
6 Congruences
Now we shall develop a very convenient and powerful “language” for expressing and solving problems in
number theory.

Here is the basic definition. Let a and b be integers and m a natural number greater than 1.If m | a−b
then a and b are called congruent modulo m, denoted

a ≡ b (mod m).

An expression like this is called a congruence. In particular, if 0 ≤ b < m we say that b is the remainder
of a modulo m.
As we see, using congruences is just another way to speak about divisibility. Thus many properties of
divisibility can easily be translated into properties of congruences. Here are the basic ones (a, b, c, d, k, n
are arbitrary integers and m is a natural number):
(CON1) a ≡ b (mod m) if and only if a − b ≡ 0 (mod m);
(CON2) a ≡ a (mod m);
(CON3) if a ≡ b (mod m) then b ≡ a (mod m);
(CON4) if a ≡ b (mod m) and b ≡ c (mod m) then a ≡ c (mod m);
(CON5) if a ≡ b (mod m) and c ≡ d (mod m) then ak + cn ≡ bk + dn (mod m). In particular
(a) if a ≡ b (mod m) then a + c ≡ b + c (mod m) and a − c ≡ b − c (mod m);
(b) if a ≡ b (mod m) and c ≡ d (mod m) then a + c ≡ b + d (mod m) and a − c ≡ b − d (mod m);
(CON6) if a ≡ b (mod m) and c ≡ d (mod m) then ac ≡ bd (mod m);
(CON7) if a ≡ b (mod m) and n ≥ 0 then an ≡ bn (mod m);
(CON8) if a ≡ b (mod m) and d | m, d > 0 then a ≡ b (mod d);
(CON9) if a ≡ b (mod m) and c > 0, then ac ≡ bc (mod mc).
All these properties are straightforward consequences of the definition of a congruence and the basic
properties of divisibility. Let us verify two of them:

(CON5) Let a ≡ b (mod m) and c ≡ d (mod m). Then m | a − b and m | c − d. Therefore m | ak − bk and
m | cn − dn, hence m0 div(ak − bk) + (cn − dn), i.e. m | (ak + cn) − (bk + dn) which means that
ak + cn ≡ bk + dn (mod m).
(CON6) Again m | a − b and m | c − d, hence m | (a − b)c and m | (c − d)b. Therefore m | (a − b)c − (c − d)b,
i.e. m | ac − bd, so ac ≡ bd (mod m).

Exercise. Verify the other properties listed above.

Here is a typical demonstration of the power of congruences:


77
Problem: Find the last two digits of 77 .
Solution: First, notice that the last two digits (in decimal notation) of any natural number are given
by the remainder of that number modulo 100. Therefore we have to solve for x the congruence
77
77 ≡ x (mod 100), 0 ≤ x < 100.

The idea is to start with some power of 7 which has a small remainder modulo 100, preferably 1 or −1,
77
and then to raise that congruence to a power close to 77 . In this case we are lucky to have

74 = 2401 ≡ 1 (mod 100).

14
77
Now we want this congruence to some power x such that (74 )x = 74x is as close as possible to 77 . Then
7 77
we would get 74x ≡ 14x = 1 (mod 100) and, suppose that 77 = 4x + y, then 77 = 74x · 7y , from where
77
77 ≡ 7y (mod 100).
7
Thus we can reduce our problem to: find the remainder y of 77 modulo 4, i.e. solve for y the congruence
7
77 ≡ y (mod 4), 0 ≤ y < 4.
7 7
We have 7 ≡ −1 (mod 4), hence 77 ≡ (−1)7 = −1 ≡ 3 (mod 4). Therefore
77
77 = 73 = 343 ≡ 43 (mod 100).
77
Thus, the last two digits of 77 are 43.
It’s like magic isn’t it?

We can see that in a way the congruences behave like equalities with respect to addition, subtraction
and multiplication. With division however, the matter is delicate. Instead of the usual cancellation law,
the following holds.
Theorem 6.1. for all integers a, x, y and any natural number m, ax ≡ ay (mod m) if and only if x ≡ y
m
(mod (a,m) ).

Proof. We may assume that a 6= 0 and x 6= y, otherwise the statement is trivial. Now, if ax ≡ ay
(mod m) then ax − ay = km for some integer k/ne0. Hence
a m
(x − y) = k.
(a, m) (a, m)
and thus
m a
(x − y).
(a, m) (a, m)
 
m a m
But (a,m) , (a,m) = 1 by (GCD7). Therefore (a,m) (x − y) by Theorem 3.1 (1), which implies x ≡ y
m
(mod (a,m) ).
m am a
Conversely, if x ≡ y (mod (a,m) ) then ax ≡ ay (mod (a,m) ) by (CON9). The number b = (a,m) is
am
an integer, hence m | (a,m) and therefore ax ≡ ay (mod m) by (CON8).

For example, x ≡ y (mod 5) if and only if 12x ≡ 12y (mod 30).

As a consequence we obtain the following frequently used fact:


Corollary 6.2. If ax ≡ ay (mod m) and (a, m) = 1, then x ≡ y (mod m).
For example, if 45x ≡ 45y (mod 14), then x ≡ y (mod 14).
Theorem 6.3. x ≡ y (mod mi ) for i = 1, 2, . . . , k if and only if x ≡ y (mod [m1 , m2 , . . . , mk ]).
Proof. if x ≡ y (mod mi ) for i = 1, 2, . . . , k then mi | (x − y) for i = 1, 2, . . . , k. Thus x − y is a
common multiple of m1 , m2 , . . . , mk and hence [m1 , m2 , . . . , mk ] | (x − y) by Theorem 4.1, which implies
x ≡ y (mod [m1 , m2 , . . . , mk ]). Conversely if x ≡ y (mod [m1 , m2 , . . . , mk ]) then x ≡ y (mod m1 ) for
i = 1, 2, . . . , k by (CON8).

Problems
6.1. Show that
(a) every decimal number which is a square has one of the following for its unit digit: 0, 1, 4, 5,
6, 9.

15
(b) every decimal number which is a fourth power has one of the following for its digit: 0, 1, 5, 6.
6.2. Find
(a) the possible remainders modulo 8 of any square of an integer.
(b) the possible remainders modulo 7 of any cube of an integer.
6.3. Find the last decimal digit of (a) 2222 ; (b) 3333 ; (c) 7777 .
6.4. Prove that the number 3n2 − 5 where n is an integer can never be a perfect square.
6.5. Prove that if x ≡ y (mod m) then (x, m) = (y, m).
6.6. Show that any natural number n in decimal representation is divisible by
(a) 3 if and only if the sum of its digits is divisible by 3.
(b) 9 if and only if the sum of its digits is divisible by 9.
6.7. Let A be the sum of its digits of the number 44444444 and B be the sum of the digits of A. Find
the sum of the digits of B. (All numbers are decimal.)
This was Problem 4 from the 17th IMO in Bulgaria, 1975.

7 Residue systems. Euler’s function.


Theorems of Euler and Fermat
Given a natural number m, we consider the set of numbers {0, 1, 2, . . . , m − 1}. This is the set of all
possible remainders modulo m, therefore it has the following property: every integer is congruent modulo
m to exactly one number from this set. The sets {1, 2, . . . , m}, {2, 3, . . . , m + 1}, {−1, 0, . . . , m − 2} and
infinitely many others have the same property. This observation leads us to the following definition.
Given a natural number m, a set of integers {x1 , . . . , xm } is called a complete residue system modulo
m if for every integer y there is exactly one xi such that y ≡ xi (mod m).
Of course the numbers x1 , . . . , xm do not need to be consecutive. For instance {−25, 13, 134, −1359, 2}
is a complete residue system modulo 5.
Let us notice that:
(1) m integers form a complete residue system modulo m if and only if no two of them are congruent
modulo m.
(2) If x1 , . . . , xm is a complete residue system modulo m then for any integer a, the numbers x1 +
a, . . . , xm + a is such a complete residue system modulo m.

Exercise. Verify these facts.


Theorem 7.1. If x1 , . . . , xm is a complete residue system modulo m and k is an integer relatively prime
to m, then kx1 , . . . , kxm is also a complete residue system modulo m.
Proof. Suppose kxi ≡ kxj (mod m) for some i 6= j. Then m | k(xi − xj ) and since (m, k) = 1, it follows
by Theorem 3.1 (1) that m | (xi − xj ) which contradicts the assumption that x1 , . . . , xm is a complete
residue system modulo m.
Now we shall introduce a function on the set of natural numbers which plays an important role in
number theory. It is called Euler’s function, denoted by φ and defined for all natural numbers as follows:

φ(n) equals the number of positive integers less than or equal to n and relatively prime to n.

For example φ(1) = 1, φ(11) = 10 and φ(12) = 4.

Obviously for large values of n the definition is not convenient for computation of φ(n) and we need
some sort of a formula. In order to find such a formula we have to make several observations about
Euler’s function.

16
(1) If n is prime then φ(n) = n − 1 since all n − 1 positive integers less than n are relatively prime to
n.
(2) If n = pk where p is prime then φ(n) = pk − pk−1 . Indeed, the numbers between 1 and pk which
are not relatively prime to pk are exactly the pk−1 multiples of p: 1 · p, 2 · p, . . . , pk−1 · p and the
remaining pk − pk−1 numbers are relatively prime to pk .
(3) φ(n) has the following multiplicative property: for every two relatively prime natural numbers m
and n,
φ(mn) = φ(m)φ(n).
In order to verify this property let us arrange the integers from 1 to mn in a rectangular table with
m rows and n columns as follows:
1 2 ··· n
n+1 n+2 ··· 2n
2n + 1 2n + 2 ··· 3n
.. .. .. ..
. . . .
(m − 1)n + 1 (m − 1)n + 2 ··· mn
We see that the number in the i-th row and j-th column of this table is (i − 1)n + j.
First let us notice that this number is relatively prime to n if and only if j is relatively primes to
n, by (GCD5). Thus the numbers from the table which are relatively prime to n are precisely the
elements of those φ(n) columns which correspond to the numbers j relatively prime to n.
Next, 0 · n, 1 · n, . . . , (m − 1)n is a complete residue system modulo m since (m, n) = 1, by Theorem
7.1. Therefore 0 · n + j, 1 · n + j, . . . , (m − 1)n + j is a complete residue system modulo m for
every integer j. Thus the numbers from the table which are relatively prime to m are precisely the
elements of those φ(m) rows which correspond to the numbers i for which i − 1 is relatively prime
to n.
Now, the numbers from the table which are relatively prime to mn are those which are relatively
prime to n and the φ(m) rows with numbers relatively prime to m. therefore there are exactly
φ(m) · φ(n) numbers in the table which are relatively prime to mn, i.e. φ(mn) = φ(m)φ(n).
• Applying Theorem 3.1 (3) several times we can generalize the multiplicative property of φ(n) as
follows:
If n1 , . . . , nk are relatively prime in pairs, then
φ(n1 · · · nk ) = φ(n1 ) · · · φ(nk ).
αk αk
Now we are ready to compute φ(n) for any natural number n. Let n = pα α1
1 · · · pk where p1 , . . . , pk
1

are powers of different primes. (Due to the Fundamental theorem of arithmetic every natural numbers
can be represented in this way.) Then every two of these powers are relatively prime. Applying the
properties (4) and (2) of φ(n) we find:
αk α1 −1 αk −1
φ(n) = φ (pα α1
· · · pα
 
1 ) · · · φ (pk ) = p1 − p1 k − pk .
1 k

In a slightly more concise form:    


αk
If n = pα1 · · · pk , then φ(n) = n 1 −
1 1
p1 ··· 1 − 1
pk ..

For instance:
= φ(2 · 33 · 72 ) = (21 − 20 )(33 − 32 )(72 − 71 ) = 1512,
φ(2646)
1 4
and φ(1000) = φ(23 53 ) = 1000 · · = 400.
2 5
Theorem 7.2 (Euler’s Theorem). For every natural number n and integer a relatively prime to n the
following congruence holds:
aφ(n) ≡ 1 (mod n),
that is, n | (aφ(n) − 1).

17
Proof. Let x1 , . . . , xφ(n) be the natural numbers less than n and relatively prime to n. Now consider
ax1 , . . . , axφ(n) . These are φ(n) numbers which are all relatively prime to n, by Theorem 3.1 (3), and no
two of them are congruent. (A system of φ(n) integers with such properties is called a reduced residue
system modulo n). Therefore if yi is the remainder if axi modulo n for i = 1, 2, . . . , φ(n) then y1 , . . . , yφ(n)
are φ(n) different natural numbers less than n and relatively prime to n. But then they are exactly the
numbers x1 , . . . , xφ(n) , perhaps in another order! Therefore x1 · · · xφ(n) = y1 · · · yφ(n) . Now axi ≡ yi
(mod n) for i = 1, . . . , φ(n), hence (ax1 ) · · · (axφ(n) ) ≡ y1 · · · yφ(n) (mod n).
But (ax1 ) · · · (axφ(n) ) = aφ(n) x1 · · · xφ(n) = aφ(n) y1 · · · yφ(n) . Thus aφ(n) y1 · · · yφ(n) ≡ y1 · · · yφ(n)
(mod n).
Furthermore, the product y1 · · · yφ(n) is relatively prime to n by Theorem 3.1 (3). Therefore, by
Corollary 6.2, we may cancel the last congruence by y1 · · · yφ(n) and thus we find that

aφ(n) ≡ 1 (mod n).

For example, since φ(1000) = 400 and (1993, 1000) = 1 it follows that

1993400 ≡ 1 (mod 1000)

which means that the last three digits of the number 1993400 are 001. Try to imagine how much time
it would take to establish this result by calculation of the number itself. Or, consider the problem: find
77 77
the last two digits of 7777 . We can approach this problem similarly to the one about 77 , but it could
take a lot of time until we get an appropriate “starting point”. Here is where Euler’s theorem comes to
help: φ(100) = 40, hence 7740 ≡ 1 (mod 100), etc.
Exercise. Complete the solution of this problem.

The particular case of Euler’s theorem when n is prime is known as Fermat’s theorem: For every
prime number p and integer a not divisible by p the following congruence holds:

ap−1 ≡ 1 (mod p),

that is, p | (ap−1 − 1).

(Do not confuse this with the famous Fermat’s Last Theorem which, after more than 300 years of
futile attempts, was proved by the mathematician Andrew Wiles.)
Theorem 7.3. For every natural number n and integer a relatively prime to n there exists a least positive
integer k such that
ak ≡ 1 (mod n).
Moreover, every natural number m for which am ≡ 1 (mod n) is a multiple of k. In particular k | φ(n).
The number k is called the order of a modulo n, and a is said to belong to the exponent of k.
Proof. The set S of all natural numbers k for which ak ≡ 1 (mod n) is non-empty since it contains φ(n).
Then, by the fundamental property of natural numbers, there is a least natural number in S, which we
call k. Now, let m be any number from S. Dividing m by k with a remainder we get m = kq + r,
0 ≤ r < k. Then
1 ≡ akq+r ≡ akq · q r ≡ (ak )q · ar ≡ 1q · ar ≡ ar (mod n).
Thus, r satisfies ar ≡ 1 (mod n) and is less than k, hence r = 0.

Problems
7.1. Find a complete residue system modulo 7 consisting of multiples of 3.
7.2. Prove that ap ≡ a (mod p) for every prime number p and integer a.
7.3. Show that 7 | n30 − 1 if (n, 7) = 1.

18
7.4. Prove that 42 | n7 − n for every integer n.
7.5. Prove the congruences
(a) 211·31 ≡ 2 (mod 11 · 31)
(b) 219·73 ≡ 2 (mod 19 · 73)
7.6. Evaluate φ(n) for n = 1, 2, . . . , 16.
7.7. (a) Find all positive integers n for which 7 | 2n − 1.
(b) Show that for every positive integer n, 7 - 2n + 1.
This was Problem 1 at the 6th IMO in Moscow, 1964.
7.8. For every natural number n > 1 show that
X nφ(n)
=
2
m<n,(m,n)=1

where the sum ranges over all natural numbers m less than n and relatively prime to n.
7.9. (a) If n > 4 show that n is composite if and only is (n − 1)! ≡ 0 (mod n).
(b) (Wilson’s Theorem) Show that if n > 1 is a prime then (n − 1)! + 1 ≡ 0 (mod n).
7.10. Let m and n be natural numbers such that n > m ≥ 1. The last three digits in the decimal
expansion of the number 1978m coincide with the last three digits in the decimal expansion of the
number 1978n . Find m and n such that the sum m + n is minimal.
This was Problem 1 from the 20th IMO in Romania, 1978.

8 Linear congruences and Chinese Remainder Theorem


If a, b are integers and m is a natural number we say that the congruence

ax ≡ b (mod m) (2)

is a linear congruence. We are interested in the question whether this congruence has solutions for x and
how to find them.
First, let us observe that if (2) has one solution x0 then it has infinitely many solutions: x0 ± m, x0 ±
2m, . . .. We can say even more: if x0 is a solution of (2) then all solutions x of (2) and only they satisfy
m
the congruence ax ≡ ax0 (mod m), and hence due to Theorem 6.1, the congruence x ≡ x0 (mod (a,m) ).
m
Thus all solutions of (2) are given by the formula x = x0 + (a,m) k where k is any integer. For instance
6x ≡ 2 (mod 8) has a solution x = 3, hence all solutions are the numbers 3 + 4k. Therefore our problem
is reduced to find just one solution of (2) or to show that there aren’t any.
Second, in the particular case when (a, m) = 1 the congruence (2) has a solution. Indeed, let x take
values 0, 1, . . . , m − 1. This is a complete residue system modulo m. Therefore, by Theorem 7.1, the
numbers 0 · a, 1 · a, . . . , (m − 1)a is also a complete residue system modulo m. Hence at least one (in fact
exactly one) of the numbers 0, 1, . . . , m − 1 is a solution of (2).
Now we are ready to attack the general case for which the following theorem gives a necessary and
sifficient condition for existence of solution.
Theorem 8.1. The linear congruence

ax ≡ b (mod m)

has a solution if and only if (a, m) | b.

19
Proof. If x is a solution of the congruence then m | ax−b and (a, m) | m, hence (a, m) | ax−b. Moreover,
(a, m) | a, hence (a, m) | ax. Thus (a, m) | b. Conversely, if (a, m) | b, let a = (a, m)a1 , b = (a, m)b1
and m = (a, m)m1 , for some integers a1 , b1 and m1 respectively. Then, by Theorem 6.1, the congruence
ax ≡ b (mod m) is equivalent to
a1 x ≡ b1 (mod m1 ),
and furthermore (a1 , m1 ) = 1. As we noticed above, the latter congruence has a solution.
The drawback of this theorem is that is gives no idea of how to find a solution when it exists. This
is a typical example of a so-called non-constructive theorem of existence. Sometimes in mathematics the
most we can say about an object is that it exists but it is impossible in principle to find or construct
it. Fortunately this is not so in our case. Of course, if m is small enough we may check all numbers
0, 1, . . . , m − 1 until we find a solution. If m is large this is impractical and we need a more efficient
approach. Without going much into technicalities we shall sketch a procedure how to find a solution of
(2) when it exists, i.e. when (a, m) | b. The idea is to reduce in several steps the congruence until we
reach an equivalent one which has an obvious solution. First, if a and m are not relatively prime, we
may cancel by (a, m) and consider the particular case when (a, m) = 1. Then we perform the following
pair of reductions:
(1) replace a and b with their respective remainders modulo m. The resulting congruence is equivalent
to the initial one and in addition a becomes less than m.
(2) reduce the congruence (2) to
my ≡ −b (mod a)
in the following sense: if y is a solution of the latter congruence then x = my+b
a is a solution of
(2).
Just substitute this x in (2) and you will see it. The benefit of this reduction is obvious: the
modulus of the congruence has strictly decreased.
Now, applying this pair of tricks several times we shall inevitably end with a congruence modulo 1 (why?
Hint: the Euclidean algorithm for computing (a, m) is built-in in this procedure) which has an obvious
solution of (2). Or, reaching a small enough modulus we solve the congruence by inspection. Here is an
example: Solve
9965 ≡ 19955 (mod 4950).
First, (9965, 4950) = 5 and we reduce this congruence to

1993x ≡ 3991 (mod 990).

Then, 1993 = 2 · 990 + 13 and 3991 = 4 · 990 + 31. Thus we reduce our congruence to

13x ≡ 31 (mod 990).

Further we replace it by
990y ≡ −31 (mod 13),
990y+31
and note that the solution we seek is x = 13 .
Now we repeat the first two steps: 990 = 76 · 13 + 2 and −31 = −3 · 13 + 8, thus we consider

2y ≡ 8 (mod 13),

which we replace by
13z ≡ −8 (mod 2)
13·0+8
which has an obvious solution z = 0, whence y = 2 = 4 and

990 · 4 + 31
x= = 307.
13
Let us check it:
1993 · 307 = 611851 = 618 · 990 + 31 = 614 · 990 + 3991.

20
It works!
Exercise. (1) Applying the above described procedure solve the congruence 166x ≡ 18 (mod 38), or
show that there are no solutions.
Exercise. (2) Present the above procedure as a formal algorithm, as was done in section 2 with the
Euclidean algorithm for computing the greatest common divisor. Then prove the correctness of this
algorithm.
Having solved completely the problem for one linear congruence we can proceed to systems of linear
congruences. This might appear to be a piece of quite modern, though elementary mathematics, but to
our surprise it turns out that the method of solving such systems was essentially known in China in the
first century A.D.! Of course not presented in the language of congruences which makes our life much
easier than the life of the ancient Chinese mathematicians. Anyway, here is the key theorem, known as
the Chinese Remainder Theorem:
Theorem 8.2 (Chinese Remainder Theorem). Let m1 , . . . , mk be natural numbers relatively prime in
pairs and b1 , . . . , bk be any integers. Then the system of congruences

x ≡ b1 (mod m1 )
..
.
x ≡ bk (mod mk )

has a solution. Moreover, it has infinitely many solutions which are all congruence modulo the product
m1 · · · mk .
M
Proof. Let M = m1 · · · mk and Mi = mi for i = 1, 2, . . . , k. Then (M1 , . . . , Mk ) = 1 (see Problem 5.10),
hence
u1 M1 + · · · + uk Mk = 1
for some integers u1 , . . . , uk . Therefore ui Mi ≡ 1 (mod mi ) and ui Mi ≡ 0 (mod mj ) for any i 6= j
(why?). Then
x = u1 M1 b1 + · · · + uk Mk bk
is a solution of our system.
The above proof suggests a method to find a solution of the system of congruences: first we find
integers u1 , . . . , uk such that ui Mi ≡ 1 (mod mi ) for i = 1, . . . , k. Of course there are infinitely many
such integers and we cannot expect that those we have found will satisfy u1 M1 + · · · uk Mk = 1, but they
will satisfy u1 M1 + · · · uk Mk ≡ 1 (mod mi ) for i = 1, . . . , k which is enough to claim that u1 M1 b1 + · · · +
uk Mk bk is a solution of the system.
For example consider the following
Problem: Find a natural number x giving remainders 1,2,3,4 when divided by 2,3,5,7 respectively.
Solution: The problem boils down to solving the system

x ≡ 1 (mod 2)
x ≡ 2 (mod 3)
x ≡ 3 (mod 5)
x ≡ 4 (mod 7)

We look for integers u1 , u2 , u3 and u4 such that 105u1 ≡ 1 (mod 2), 70u2 ≡ 1 (mod 3), 42u3 ≡ 1 (mod 5)
and 30u4 ≡ 1 (mod 7). We find u1 ≡ 1 (mod 2), u2 ≡ 1 (mod 3), u3 ≡ 3 (mod 5) and u4 ≡ 4 (mod 7).
Possible values are u1 = 1, u2 = 1, u3 = 3 and u4 = 4 from where x = 1·1·105+2·1·70+3·3·42+4·4·30 =
1103. This is one solution. All other solutions are obtained from the formula x + [2, 3, 5, 7]k = x + 210k.
Thus the smallest positive solution is x − 210 · 5 = 53.

Now consider a linear system of congruences

a1 x ≡ b1 (mod m1 )
..
.
ak x ≡ bk (mod mk )

21
where m1 , . . . , mk are natural numbers relatively prime in pairs and each of the congruences has a
solution. Let x1 , . . . , xk be respective solutions to these congruences. Then the above system is equivalent
to
x ≡ x1 (mod m1 )
..
.
x ≡ xk (mod mk )
which according to the Chinese Remainder Theorem has a solution.

Note that the Chinese Remainder Theorem gives only sufficient but not necessary conditions for the
existence of a solution of a system of linear congruences. Indeed the system

x≡2 (mod 6)
..
.
x ≡ 6 (mod 8)

has a solution e.g. x = 14, without satisfying the conditions of the theorem. Let us only mention that
there exist necessary and sufficient conditions which we are not going to discuss here.

Problems
8.1. Solve the congruences or show that there are no solutions.
(a) 25x ≡ 5 (mod 16); (b) 1001x ≡ 91 (mod 104); (c) 3700x ≡ 11 (mod 111).

8.2. Find the smallest possible solutions of the following systems of congruences

x ≡ 2 (mod 3)
x ≡ 0 (mod 3)
x ≡ 2 (mod 4) x ≡ 1 (mod 4)
(a) (b) x ≡ 1 (mod 5) (c)
x ≡ 3 (mod 9) x ≡ 1 (mod 5)
x ≡ 7 (mod 8)
x ≡ −2 (mod 17)

8.3. Every two of n arithmetic progressions have a common term. Show that all progressions have a
common term.
8.4. Show that for every natural number n, in every arithmetic progression of natural numbers there
are n consecutive terms which are composite numbers.
8.5. Prove that for every natural number k there exists a prime p such that each of the numbers p − 1,
p + 1 and p + 2 has at least k different prime divisors.

Hints and Solutions


Chapter 1
1.1. Hint: If a 6= 0 and b | a then |b| ≤ |a|.
1.2. 100 = 9 · 11 + 1, 1000 = 90 · 11 + 10. Therefore the multiples of 11 between 100 and 1000 are
10 · 11, 11 · 11, . . . , 90 · 11. They are 90 − 10 + 1 = 81.
1.3. If n is even, say n = 2k, then n2 = 4k 2 = k 2 · 4 + 0. If n is odd, say n = 2k + 1, then
n2 = 4k 2 + 4k + 1 = (k 2 + k) · 4 + 1.
1.4. Hint: Use Pythagoras’s theorem.

(a) Consider the possible remainders of a square divided by 3.


(b) Similarly.
1.5. Hints:

22
(a) if d is the last digit of n then n = 10n0 + d = (5n0 ) · 2 + d. Then 2 | n if and only if 2 | d.
(b) if d1 d2 are the last two digits of n then n = 100n0 + 10d1 + d2 and 4 | 100n0 , hence 4 | n if and
only if 4 | 10d1 + d2 .
(c) See (a).
1.6. Let n, n + 1, . . . , n + k − 1 be k consecutive integers and let r be the remainder after dividing n
by k, i.e. n = qk + r, 0 ≤ r < k. If r = 0 then k | n. Otherwise r ≥ 1, hence r + k − 1 ≥ k
and therefore one of the consecutive integers r, r + 1, . . . , r + k − 1, say r + j, equals k. Then
n + j = kq + (r + j) = kq + k, hence k | n + j.
Now suppose that two of the integers, say n + i and n + j are divisible by k and let j ≥ i. Then
k | (n + j) − (n + i), i.e. k | j − i. But 0 ≤ j − i < k hence j − i must be 0.
1.7. (a) Let n = 2k + 1. Then n2 − 1 = 4k 2 + 4k and 2 | k(k + 1) hence 4 · 2 | 4k(k + 1).
(b) Induction on n:
If n = 1 then 32·1 − 1 = 8 and the statement is true.
Assume that 8 | 32n − 1 for some n. Then 32(n+1) − 1 = 9 · 32n − 1 = 8 · 32n + (32n − 1) which,
according to the inductive hypothesis, is divisible by 8.
(c) Again induction on n
If n = 1 then 41 + 15 · 1 − 1 = 18 — divisible by 9.
Assume that 9 | 4n + 15n − 1 for some n. Then 9 | 4(4n + 15n − 1) = 4n+1 + 60n − 4 and in
order to check that 9 divides 4n+1 + 15(n + 1) − 1 = 4n+1 + 15n + 14 it is enough to show that
9 divides (4 · 4n + 60n − 4) − (4 · 4n + 15n + 14) = 45n − 18 = (5n − 2) · 9 which is obvious.
1.8. (a) Let 2k be the greatest power of 2 not exceeding n. Then 21k will be the only term in the sum
N1 with an odd numerator after reducing the sum to a common denominator. Therefore the
numerator of the resulting fraction will be odd, whilst the denominator will be even, hence
the fraction cannot be an integer.
(b) Similarly: consider the term with denominator divisible by the greatest possible power of 2.
(c) Consider the therm with denominator which is the greatest possible power of 3, say 3k . Note
that 2·31 k does not occur in the sum N3 . Now continue similarly to (a).
1.9. For n = 0 we get m | a + d, (1)
for n = 1: m | ab + c + d, (2)
for n = 2: m | ab2 + 2c + d, (3)
Then: (2) − (1) ⇒ m | a(b − 1) + c,
hence m | ab(b − 1) + bc, (4)
and (3) − (2) ⇒ m | ab(b − 1) + c, (5)
hence m | abc(b − 1) + c2 , (6)
then (4) − (5) ⇒ m | c(b − 1),
hence m | abc(b − 1). (7)
Finally (6) − (7) ⇒ m | c2 .
1.10. Divide N by m with a remainder: N = mq0 + r0 and put c0 = r0 . If q0 < m we are done putting
c1 = q0 . Otherwise we divide q0 by m with remainder: q0 = mq1 + r1 and put c1 = r1 . Then
proceed in the same way with q1 , etc. Thus we obtain a sequence q0 > q1 > · · · of natural numbers.
Due to the fundamental property of the natural numbers this process must stop after one or more
steps, namely when some qk becomes less than m. Then we put ck = qk and obtain a representation
of N in the desired form.
Now let us show that such a representation is unique. Suppose that there are two different ones:

N = c1 + c1 m + c2 m2 + · · · + ck mk , (1)

and
N = d0 + d1 m + d2 m2 + · · · + dt mt .(2)

23
We may assume that k ≥ t and extend the second sum to

N = d0 + d1 m + d2 m2 + · · · + dk mk , (20 )

putting dt+1 = · · · = dk = 0.
Let j be the least index for which cj 6= dj and assume that cj > dj . Then subtracting (2’) from
(1) and dividing the result by mj we obtain

0 = (cj − dj ) + (cj+1 − dj+1 )m + · · · + (ck − dk )mk−j = (cj − dj ) + Cm.

Then m | (cj − dj which is impossible since 0 < cj − dj < m.

Chapter 2
2.1. Hint: if (n, 4) = 2 then n = 4k + 2 for some integer k.

2.2. No. Otherwise 3 | x and 3 | y, hence 3 | x + y = 1000.


2.3. Using repeatedly (GCD5) we simulate the Euclidean algorithm: (3a + 5b, 11a + 18b) = (3a +
5b, 11a + 18b − 3(3a + 5b)) = (3a + 5b, 2a + 3b) = (3a + 5b − (2a + 3b), 2a + 3b) = (a + 2b, 2a + 3b) =
(a + 2b, 2a + 3b − 2(a + 2b)) = (a + 2b, −b) = (a + 2b + 2(−b), −b) = (a, −b) = (a, b).

2.4. Again we use (GCD5):

(21n + 4, 14n + 3) = (7n + 1, 14n + 3) = (7n + 1, 1) = 1.

2.5. By (D10) cC | aA, cC | aB, cC | Ab and cC | AB, hence cC | (aA, aB, Ab, AB). Now, by Theorem
2.1, c = ua + vb for some integers u and v; likewise C = U A + V B for some integers U and V . Then
cC = (ua+vb)(U A+V B) = (uU )aA+(uV )aB +(U v)Ab+(U V )AB), hence (aA, aB, Ab, AB) | cC.
Therefore (aA, aB, Ab, AB) = cC.
n n n n+1
2.6. Suppose m > n and let (am , an ) = d. Then d | k 2 +1, hence d | (k 2 +1)(k 2 −1) = k 2 −1, hence
n+1 n+1 n+2 m m m
d | (k 2 − 1)(k 2 + 1) = k 2 − 1, etc. Finally d | k 2 − 1. Then d | (k 2 + 1) − (k 2 − 1) = 2.
Now, if k is even then every ai is odd, hence d = 1; if k is odd then every ai is even, hence d = 2.

2.7. For every natural number k, ak − 1 = (a − 1)(ak−1 + ak−2 + · · · + a + 1) (check this!). Then
am −1 m−1
a−1 = a + am−2 + · · · + a + 1 = (am−1 − 1) + (am−2 − 1) + · · · + (a − 1) + m. Now,
m

−1
let aa−1 , a − 1 = d1 and (a − 1, m) = d2 . Then d1 | ak − 1 for k = 1, 2, . . . , m − 1 and
d1 | (am−1 − 1) + (am−2 − 1) + · · · + (a − 1) + m, hence d1 | m. Thus d1 | d2 . Conversely, d2 | ak − 1
for k = 1, 2, . . . , m − 1, hence d2 | (am−1 − 1) + (am−2 − 1) + · · · + (a − 1) and d2 | m, hence
m
−1
d2 | (am−1 − 1) + (am−2 − 1) + · · · + (a − 1) + m = aa−1 . Thus d2 | d1 , hence d1 = d2 .
2.8. If m = n then d = m = n and the statement is obvious. Let m 6= n and suppose n > m.
Dividing n by m with a remainder we get n = mq + r, 0 ≤ r < m. Then an − 1 = amq+r − 1 =
amq ar − 1 = (amq ar − ar ) + (ar − 1) = ar ((am )q − 1) + (ar − 1) = A(am − 1) + (ar − 1). Therefore
(an − 1, am − 1) = (A(am − 1) + (ar − 1), am − 1) = (ar − 1, am − 1). by (GCD5).
Now, the solution can be completed either by induction on max(m, n) or by following the steps in
the Euclidean algorithm for computing (m, n).

Chapter 3
3.1. (a) 6, 10, and 15.
(b) 30, 42, 70 and 105.
(c) 30, 154, 273 and 715.
3.2. Amongst any 5 consecutive integers there is one which is odd and not divisible by 3.

24
3.3. (a) The product of every 3 consecutive integers is divisible by 2 and by 3 (follows from Problem
1.5), hence by Theorem 3.1 (4) it is divisible by 6.
(b) The product of every 4 consecutive integers is divisible by 3 and by 8, since some of them is
divisible by 4 (Problem 1.3) and another one is divisible by 2.
(c) Use (b) and Theorem 3.1 (4).
3.4. (a) Due to Theorem 3.1 (4) it is enough to show that 2 | n3 − n and 3 | n3 − n. This follows e.g.
from Problem 1.5 because n3 − n = (n − 1)n(n + 1).
(b) Since n5 − n = (n − 1)n(n + 1)(n2 + 1), in addition to (a) it is enough to show that 5 | n5 − n.
Consider the 5 possibilities for the remainder r of n when divided by 5. If r = 2 then n = 5k+2,
hence n2 + 1 = 25k 2 + 20k + 5 which is divisible by 5. Likewise 5 | n2 + 1 when r = 3. When
r is 0, 1 or 4 then 5 | n, 5 | n − 1 and 5 | n + 1 respectively. Thus, in any case 5 | n5 − n.
(c) n5 − 5n3 + 4n = (n − 2)(n − 1)n(n + 1)(n + 2). Now use Problem 3.3 (c).
3.5. We shall apply a sort of inductive reasoning. Given k terms of the sequence:

a1 = 2n1 − 3, a2 = 2n2 − 3, . . . , ak = 2nk − 3,

which are relatively prime in pairs, and such that 2 = n1 < n2 < · · · < nk , we shall construct
a number ak+1 = 2nk+1 − 3 relatively prime to each of these numbers. Let m = a1 a2 · · · ak .
Amongst the m + 1 numbers 20 , 21 , . . . , 2m there are two which yield the same remainder when
divided by m (pigeon-hole principle). Let 2r and 2s be two such numbers and let r > s. Then
pm = 2r − 2s = (2r−s − 1)2s for some natural number p. Since m is odd and hence (m, 2s ) = 1,
it follows that m | 2r−s − 1, hence qm = 2r−s − 1 for some natural number q. Then we put
ak+1 = 2r−s+2 − 3 = 4 · 2r−s − 3 = 4(qm + 1) − 3 = 4qm + 1. Obviously it is relatively prime to
m, and hence to each of a1 , a2 , . . . , ak and moreover ak+1 > m > ak .
In this way we can construct arbitrarily many (and hence there are infinitely many) terms of the
sequence {2n − 3} satisfying the condition of the problem.
3.6. Hint: First note that

tn − 1 = tn−1 (tn−1 − 1)
tn−1 − 1 = tn−2 (tn−2 − 1)
···
t2 − 1 = t1 (t1 − 1).

Then show that the sequence is increasing, hence tn > 1 for every n. Now, multiplying all inequal-
ities above we get tn = 1 + t1 t2 · · · tn−1 .

Chapter 4
n(n+1)
4.1. [n, n + 1] = (n,n+1) = n(n + 1).

4.2. Hint: note that [m, n] is not 0, being equal to (m, n). Then (m, n) ≤ m ≤ [m, n] and (m, n) ≤ n ≤
[m, n].
4.3. Hint: m = 10a, n = 10b and 100ab = mn = (m, n)[m, n] = 1000, hence ab = 10.
4.4. See Problem 4.5 for m = n + 1.

4.5. Let M1 = [1, 2, . . . , m, n, n + 1, . . . , n + m − 1] and M2 = [n, n + 1, . . . , n + m − 1]. First, clearly


M2 | M1 . Now, in order to prove that M1 | M2 it is enough to notice that [n, n + 1, . . . , n + m − 1]
is a common multiple of 1, 2, . . . , m, n, n + 1, . . . , n + m − 1, which follows from the fact that for
every k = 1, 2, . . . , m, one of the numbers n, n + 1, . . . , n + k − 1 is divisible by k (Problem 1.5).

25
Chapter 5
5.1. (a) We shall modufy Euclid’s proof of Theorem 5.2. Suppose that there are finitely many primes
of the form 4n + 3 and let p1 , p2 , . . . , pk be all of them. Then consider the number

N = 4p1 p2 · · · pk + 3.

Since N is greater than each of p1 , p2 , . . . , pk it must be composite. Then it has at least one
prime divisor of the form 4n + 3 (why?). Now proceed as in the proof of Theorem 5.2.
(b) Similar to (a).
5.2. (a) Let p be a prime and p = 30q + r, 0 ≤√r < 30. Suppose that r is neither 1 nor prime. Then r
has a prime divisor not greater than r < 6, i.e. 3 or 5. But 30 is divisible by both of them,
hence so is p. Therefore p is 3 or 5 and r = p, hence r is prime, which is a contradiction.
(b) No. 109 is a prime, but 109 = 1 · 60 + 49.
5.3. Hint: Induction on n. Use the inequalities

pn ≤ p1 p2 · · · pn−1 ,

which follows from the proof of Theorem 5.2, and

21 + 22 + · · · + 2n−1 < 2n .

5.4. The number n! − 1 is not divisible by any of 2, 3, . . . , n. Therefore it is either prime of has a prime
divisor greater than n.
5.5. Suppose p = mn where m, n > 1. Let k = 2m . Then 2p − 1 = 2mn − 1 = (2m )n − 1 = k n − 1 =
(k − 1)(k n−1 + · · · + k + 1) and both factors are greater than 1. Therefore 2p − 1 is composite.
5.6. Suppose that 2n + 1 is prime and n is not a power of 2. Then n has some odd divisor m > 1:
n = qm. Let k = 2q . Then 2n + 1 = 2qm + 1 = k m + 1 = (k + 1)(k m−1 − k m−2 + · · · − k + 1) and
both factors are greater than 1 (why?), hence 2n + 1 is composite.
5.7. If 2m − 1 is a prime then the sum of proper divisors of 2m−1 (2m − 1) is

S = 1 + 2 + 22 + · · · + 2m−1 + (2m − 1) + 2(2m − 1) + · · · + 2m−2 (2m − 1)


= 2m − 1 + (1 + 2 + 22 + · · · + 2m−2 )(2m − 1)
= (2m − 1) + (2m−1 − 1)(2m − 1) = 2m−1 (2m − 1),

hence 2m−1 (2m − 1) is a perfect number. Conversely, let n = 2m−1 (2m − 1) be a perfect number.
Since all terms in the sum S are divisors of n and S = n, they must be all divisors of n, hence
2m − 1 must be prime.
5.8. (a) If all inequalities hold, then clearly m | n. Conversely, if m | n, suppose that αi > βi for some
i. Assume for convenience that i = 1. Then

pβ1 1 p1α1 −β1 · · · pα


k
k
pβ1 1 pβ2 2 · · · pβkk ,

1 −β1
hence, by (D9), pα
1 · · · pα
k
k
pβ2 2 · · · pβkk which implies p1 | pβ2 2 · · · pβkk since α1 − β1 > 0.
But this means that p1 divides some of p2 , . . . , pk which is a contradiction to the fact that
p1 , p2 , . . . , pk are different primes.
(b) Follows easily from (a).
αk β1 βk γ1 γk
5.9. (a) Let a = pα
1 · · · pk , b = p1 · · · pk and c = p1 · · · pk , where some of the α’s, β’s and γ’s can be
1

0. Then the probelm boils down to the identity min(a, max(b, c)) = max(min(a, b), min(a, c))
which can be verified by inspection of all possible orderings of a, b and c.
The proofs of the other identities are similar.

26
5.10. Suppose that m1 , . . . , mk are relatively prime in pairs and (M1 , . . . , Mn ) > 1. Then M1 , . . . , Mn
have a common divisor p. Thus p divides M1 = m2 · · · mn hence p | mi for some i. Then p - mj
for any j 6= i. Therefore p - Mi — a contradiction. Conversely, suppose that (mi , mj ) = d > 1 for
some mi 6= mj , i 6= j. Then d | Mk for every k 6= i and for every k 6= j, hence d | Mk for every
k = 1, . . . , n.
5.11. Hint: Induction on k. When k = 2 the sequence (n + 1)! + 2, . . . , (n + 1)! + n, (n + 1)! + (n + 1)
satisfies the condition. Suppose that for some k we have found numbers N, N + 1, . . . , N + (n − 1)
with the desired property. Then for k + 1 consider the sequence (N + (n − 1))! + N, (N + (n −
1))! + (N + 1), . . . , (N + (n − 1))! + (N + (n − 1)).

Chapter 6
6.1. Hints:
(a) if d is the units digit of n then n ≡ d (mod 10), hence n2 ≡ d2 (mod 10). Now consider d2
(mod 10) for d = 0, 1, . . . , 9.
(b) Similar.
6.2. Hint: consider
(a) 02 , 12 , . . . , 72 (mod 8). Answer: 0, 1, 4;
(b) 03 , 13 , . . . , 63 (mod 7). Answer 0, 1, 6.
6.3. Answers: (a) 4; (b) 3; (c) 7.
6.4. Hint: consider the possible remainders of 3n2 − 5 modulo 4 and use Problem 1.3.
6.5. Let x − y = km for some integer k. Since (x, m) | m and (x, m) | x we have (x, m) | x − km, i.e.
(x, m) | y. Then (x, m) | (y, m). Likewise (y, m) | (x, m). Therefore (x, m) = (y, m).
6.6. Let dk dk−1 · · · d1 d0 be the decimal representation of n. Then n = dk ·10k +dk−1 ·10k−1 +· · ·+d1 ·10+
d0 . Now note that 10m ≡ 1 (mod 3) for every natural number m, hence n ≡ dk +dk−1 +· · ·+d1 +d0
(mod 3).
Likewise n ≡ dk + dk−1 + · · · + d1 + d0 (mod 9).

6.7. Let C be the sum of the digits of B. Since 44444444 < 100004444 the number of digits of 44444444 is
less than 4 · 4444 + 1 < 20000. Therefore A < 9 · 20000 = 180000, hence B < 9 · 5 = 45 (why?), so
C < 13 (why?). Now, 4444 ≡ −2 (mod 9) and (−2)4444 = 23·1481+1 , hence 44444444 ≡ 2 · 81481 ≡
2 · (−10)1841 ≡ −2 ≡ 7 (mod 9). Therefore A ≡ 7 (mod 9), hence B ≡ 7 (mod 9), hence C ≡ 7
(mod 9) (by Problem 6.6). Then the only possible value of C is 7.

Chapter 7
7.1. 0, 3, 6, 9, 12, 15, 18. Hint: Use Theorem 7.1.
7.2. Hint: Use Fermat’s theorem.

7.3. by Fermat’s theorem n6 ≡ 1 (mod 7), hence n30 = (n6 )5 ≡ 15 ≡ 1 (mod 7).
7.4. n7 −n = n(n−1)(n+1)(n2 −n+1)(n2 +n+1). Now, 7 | n7 −n (Problem 7.2) and 6 | n(n−1)(n+1)
(Problem 3.3) hence 6 | n7 − n. Then, by Theorem 3.1 (4), 42 | n7 − n.
7.5. (a) By Fermat’s theorem, 210 ≡ 1 (mod 11), hence 211 ≡ 2 (mod 11), so 211·31 ≡ 231 ≡ (210 )3 ·2 ≡
2 (mod 11). Likewise 230 ≡ 1 (mod 31), hence 231 ≡ 2 (mod 31), so 211·31 ≡ 211 ≡ (25 )2 · 2 ≡
2 (mod 31) since 25 = 32 ≡ 1 (mod 31).
(b) Similarly.
7.6. Answers: 1, 1, 2, 2, 4, 2, 6, 4, 6, 4, 10, 4, 12, 6, 8, 8.

27
7.7. (a) 21 ≡ 2 (mod 7), 22 ≡ 4 (mod 7), 23 ≡ 1 (mod 7), hence 23k+r ≡ 2r (mod 7). Then 7 | 2n − 1
if and only if 2n ≡ 1 (mod 7) if and only if n = 3k for some integer k.
(b) Follows from (a).
Let usP denote the sum by S. Notice that for every k < n if (k, n) = 1 then (n − k, n) = 1. Then
2S = m<n,(m,n)=1 m + (n − m) where m ranges on all φ(n) natural numbers less than n and
relatively prime to n. Thus 2S = nφ(n).
7.8. (a) n is composite if and only if n = n1 n2 for some integers n1 , n2 such that 1 < n1 < n and
1 < n2 < n. If n1 6= √ n2 then they both occur as factors in (n − 1)!, hence n1 n2 | (n − 1)!.
Otherwise n1 = n2 = n > 2, hence 2n1 < n and again n1 · 2n1 | (n − 1)!
(b) For n = 2, 3, 4 the statement is verified by a direct inspection. Now, suppose that n > 4.
If (n − 1)! + 1 ≡ 0 (mod n) then n must be prime, by (a). Conversely, let n be prime. For
every k between 2 and n − 2, (k, n) = 1, hence k · 0, k · 1, . . . , k(n − 1) is a complete residue
system modulo n. Therefore there is exactly one m between 0 and n − 1 such that k · m ≡ 1
(mod n). This m cannot be 0, 1 or n − 1, otherwise k · m would be congruent respectively
to 0, k and p − k 6= 1 modulo n. Moreover, id k1 and k2 are two different numbers between
2 and n − 2 and 1 ≤ m ≤ n − 1 then mk1 6≡ mk2 (mod n), otherwise n | m(k1 − k2 ) which
is impossible since (n, m) = 1 and (n, k1 − k2 ) = 1. Thus, the numbers 2, 3, . . . , n − 2 are
grouped into pairs {k, m} such that km ≡ 1 (mod 1). Then 2 · 3 · · · (n − 2) ≡ 1 (mod n),
hence (n − 1)! = 1 · 2 · 3 · · · (n − 2)(n − 1) ≡ n − 1 ≡ −1 (mod n).
(c) If the last three digits in the decimal record of 1978m and 1978n coincide then 1000 | (1978n −
1978m ), i.e. 23 · 53 | 1978m (1978n−m − 1). Then 23 | 1978m because 1978n−m − 1 is odd.
Therefore m ≥ 3 since 1978 = 989 · 2. Further, by Euler’s theorem 1978φ(125) = 1978100 ≡ 1
(mod 53 ), i.e. 53 | 1978100 − 1. Denote the minimal possible value of n − m for which
53 | (1978n−m − 1) by k. We are going to show that k = 100. First, by Theorem 7.3, k | 100.
Further, by Fermat’s theorem, 19784 ≡ 1 (mod 5) and 19782 ≡ 32 ≡ 4 (mod 5), hence 4 is
the minimal positive integer r for which 5 | 1978r − 1. Therefore 4 | k, hence the possible
values of k are 4, 20 and 100l Now, 1978 ≡ (−22) (mod 125), hence
19782 ≡ (−22)2 = 484 ≡ −16 (mod 125), hence
19784 ≡ (−16)2 = 256 ≡ 6 (mod 125). Therefore
197820 ≡ 65 = 7776 ≡ 26 (mod 125). Thus, k must be 100. Therefore n − m ≥ 100 and
m ≥ 3 which imply that the required values of m and n are m = 3 and n = 103.

Chapter 8
8.1. (a) x ≡ 13 (mod 16); (b) x ≡ 3 (mod 104); (c) no solutions.
8.2. (a) 30; (b) 111; (c) 1001.
8.3. Induction on n. If n = 2 the statement is true. Suppose that it is true for every n − 1 arithmetic
progressions satisfying the condition of the problem and let n arithmetic progressions be given with
differences d1 , . . . , dn . Then the first n − 1 progressions have a common term t. We may assume
that t = 0, otherwise we subtract t from every term of each of the n progressions and consider the
resulting ones. Obviously if they have a common term then the original ones have a common term,
too.Thus we may regard that the first n − 1 progressions are of the kind {kdi }, i = 1, 2, . . . , n − 1
and k is an integer. Let the n-th progression be of the kind {a + kdn }. Then there are natural
numbers k1 , . . . , kn−1 and q1 , . . . , qn−1 such that
a + q 1 dn = k1 d1 (1)
a + q 2 dn = k2 d2 (2)
···
a + qn−1 dn = kn−1 dn−1 . (n-1)
Let M = [d1 . . . , dn−1 ] and mi = M
di , i = 1, . . . , n − 1. Then (m1 , . . . , mn−1 ) = 1 (Problem 5.10),
hence u1 m1 + · · · + un−1 mn−1 = 1 for some integers u1 , . . . , un−1 . Now summing u1 m1 times (1),
u2 m2 times (2), etc. un−1 mn−1 times (n − 1), we get
a(u1 m1 + · · · + un−1 mn−1 ) + qdn = (k1 u1 + · · · + kn−1 un−1 )M.

28
Therefore a + qdn ≡ 0 (mod M ), hence a + qdn is a common term of all n progressions.
8.4. Given the arithmetic progression a, a+d, a+2d, . . . where a and d are natural numbers, take primes
p1 , . . . , pk such that d < p1 < · · · < pk . Then p21 , . . . , p2k are relatively prime in pairs, hence by
the Chinese Remainder Theorem there exists a positive x such that dx ≡ −a − dj (mod p2j ), i.e.
a + d(x + j) ≡ 0 (mod p2j ), for j = 1, . . . , k. Then obviously the numbers a + d(x + j) are composite.
8.5. Let n be a fixed natural number and pk be the k-th prime. Then p1 p2 · · · pn , pn+1 pn+2 · · · p2n ,
and p2n+1 p2n+2 · · · p3n are relatively prime in pairs, hence there is an integer x such that x ≡ −2
(mod p1 p2 · · · pn ), x ≡ −1 (mod pn+1 pn+2 · · · p2n ) and x ≡ −2 (mod p2n+1 p2n+2 · · · p3n ). Now
consider the arithmetic progression x + p1 p2 · · · p3n m, m ∈ N. Since (p1 p2 · · · p3n , x) = 1 (why?) by
Dirichlet’s theorem 5.6, there is a prime p = x + p1 p2 · · · p3n m for some natural m. Then p − 1, p − 1
and p + 2 will have n different prime divisors each, namely {p1 , p2 , . . . , pn }, {pn+1 , pn+2 , . . . , p2n }
and {p2n+1 , p2n+2 , . . . , p3n } respectively.

Additional Problems
1. Show that for every odd natural number n, 48 | n3 + 3n2 − n − 3.
2. Prove that for every natural number n, 25 | 2n+1 3n + 5n − 4.
3. Prove that m | abn + cn + d for every integer n ≥ 0 if and only if m | a + d, m | (b − 1)c and
m | a(b − 1) + c.
a3 +2a
4. Show that the fraction a4 +3a2 +1 is irreducible.

5. If (a, b) = 1 show that (a + b, a2 − ab + b2 ) is either 1 or 3. If a, b and c are odd integers, prove that
a+b b+c c+a
(a, b, c) = ( , , ).
2 2 2

6. Prove that for any integers a, b and c,

(a, b) = (a + bc, a + b(c − 1)).

7. Show that 56786730 | mn(m60 − n60 ) for any integers m and n.


8. Find all three-digit numbers n such that the number formed from the last three digits of any power
of n equals n.
9. Let m and n be natural number. Show that (m, n) = 1 if and only if (2m − 1, 2n − 1) = 1.
10. Let a, b, m, n be natural numbers such that a > 1 and (a, b) = 1. Prove that if am + bm | an + bn
then m | n.
11. Prove that amongst any 16 consecutive integers there is one which is relatively prime to each of
the others.
12. Show that for wny integers a and b,

(a, b) = (a + b, [a, b]).

13. Prove that if m and n are relatively prime natural numbers such that mn is a perfect k-th power
for some k ≥ 2, then m and n are perfect k-th powers.
14. Find all pairs of natural numbers {x, y} satisfying the equation

2x = 3y + 5.

15. N is a sum of the eight powers of 100 consecutive natural numbers. Find the last digit of N .

29
16. Prove that
(a) 7 | (22225555 + 55552222 );
(b) 343 | 2147 − 1.

17. Find the last two digits of 2999 + 3999 .


18. Find the remainder modulo 7 of
10
1010 + 10( 102 ) + · · · + 10(10 )
.

19. Let a, b, n be natural number such that for any natural k 6= b, k − b | k n − a. Show that a = bn .
20. Show that 12 , 22 , . . . , m2 is not a complete residue system modulo m if m > 2.
21. For any prime p other than 2 and 5 prove that p divides infinitely many of the integers 1, 11, 111,
....

22. Find all natural number n such that φ(n) = 24.


23. Find all natural numbers n such that n | φ(n).
24. If d | n and 0 < d < n prove that n − φ(n) > d − φ(d).

25. Prove that fo any integer a and natural number m,

am ≡ am−φ(m) (mod m).

(A generalization of Euler’s theorem.)


26. If p is a prime and h, k ≥ 0 are integers such that h + k = p − 1, show that h!k! + (−1)h ≡ 0
(mod p).
27. If a and n are natural numbers and p is a prime such that (a, p) = 1 and (n, p − 1) = 1, show that
there is exactly one integer x between 1 and p such that xn ≡ a (mod p).
28. Let a and n > 1 be integers such that an−1 ≡ 1 (mod n) but ax 6≡ 1 (mod n) for every proper
divisor x of n − 1. Show that n is a prime.

29. Let k, m and n be natural numbers and (k, m) = 1 Show that there is an integer x such that
(k + mx, n) = 1.
30. Show that for all natural numbers k and m the number 2k can be represented as a difference of
two natural numbers relatively prime to m.

31. Prove that there exists a natural number k such that k · 2n + 1 is composite for every natural
number n.
32. (Problem 3 from the 24th IMO in France, 1983 ) Let a, b and c be positive integers, no two of which
have a common divisor greater than 1. Show that 2abc − ab − bc − ca is the largest integer which
cannot be expressed in the form xbc + yca + zab where x, y and z are non-negative integers.

33. (Problem 2 from the 25th IMO in Czechoslovakia, 1984 ) Find one pair of positive integers a and b
such that:
(i) ab(a + b) is not divisible by 7;
(ii) (a + b)7 − a7 − b7 is divisible by 77 . Justify your answer.

34. (Problem 6 from the 25th IMO in Czechoslovakia, 1984 ) Let a, b, c and d be odd integers such that
0 < a < b < c < d and ad = bc. Prove that if a + d = 2k and b + c = 2m for some integers k and
m, then a = 1.

30
35. (Problem 6 from the 28th IMO in Cuba, 1987 ) Let n be an integer p greater than or equal to 2.
Prove that if k 2 + k + n is prime for all integers k such that 0 ≤ k ≤ n/3 then k 2 + k + n is prime
for all integers k such that 0 ≤ k ≤ n − 2.
36. (Problem 6 from the 29th IMO in Australia, 1988 ) Let a and b be positive integers such that ab + 1
2
+b2
divides a2 + b2 . Show that aab+1 is the square of an integer.
2n +1
37. (Problem 3 from the 31th IMO in China, 1990 ) Find all n > 1 such that n2 is an integer, where
n ∈ N.
38. (Problem 5 from the 31th IMO in China, 1990 ) A game if played between two people as follows:
n0 ∈ N is chosen. Given n2k , A chooses n2k+1 ∈ N such that n2k ≤ n2k+1 ≤ (n2k )2 . Given n2k+1 ,
B chooses n2k+2 ∈ N such that nn2k+2
2k+1
is a power of a prime. A wins by choosing 1990, B wins by
choosing 1.
For what values of n0 does A win, B win and nobody win, respectively?

39. (Problem 2 from the 32th IMO in Sweden, 1991 ) Let n > 6 be an integer and a1 , a2 , . . . , ak be all
the natural numbers lee than n and relatively prime to n. If

a2 − a1 = a3 − a2 = · · · = ak − ak−1 > 0,

prove that n must be either a prime number or a power of 2.

40. (Problem 1 from the 33th IMO in Russia, 1992 ) Find all integers a, b, c with 1 < a < b < c such
that (a − 1)(b − 1)(c − 1) is a divisor of abc − 1.

31

You might also like