Elementary Number Theory - Getalscript
Elementary Number Theory - Getalscript
Elementary Number Theory - Getalscript
WISB321
F.Beukers
Department of Mathematics
2012
UU
Contents
1 Integers and the Euclidean algorithm
1.1 Integers . . . . . . . . . . . . . . . .
1.2 Greatest common divisors . . . . . .
1.3 Euclidean algorithm for Z . . . . . .
1.4 Fundamental theorem of arithmetic .
1.5 Exercises . . . . . . . . . . . . . . . .
.
.
.
.
.
4
4
7
8
10
12
2 Arithmetic functions
2.1 Denitions, examples . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 Convolution, Mobius inversion . . . . . . . . . . . . . . . . . . . .
2.3 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
15
18
20
3 Residue classes
3.1 Basic properties . . . . . . .
3.2 Chinese remainder theorem
3.3 Invertible residue classes . .
3.4 Periodic decimal expansions
3.5 Exercises . . . . . . . . . . .
.
.
.
.
.
21
21
22
24
27
29
.
.
.
.
.
33
33
38
39
41
44
.
.
.
.
.
.
47
47
48
51
52
55
59
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . . .
. . . .
. . . .
. . . .
square
. . . .
1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . . .
. . . .
. . . .
. . . .
roots
. . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
CONTENTS
5.7
Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
8 Continued fractions
8.1 Introduction . . . . . . . . . . . . . . . . . .
8.2 Continued fractions for quadratic irrationals
8.3 Pells equation . . . . . . . . . . . . . . . . .
8.4 Archimedess Cattle Problem . . . . . . . .
8.5 Cornacchias algorithm . . . . . . . . . . . .
8.6 Exercises . . . . . . . . . . . . . . . . . . . .
9 Diophantine equations
9.1 General remarks . . . . . .
9.2 Pythagorean triplets . . .
9.3 Fermats equation . . . . .
9.4 Mordells equation . . . .
9.5 The abc-conjecture . . .
9.6 The equation xp + y q = z r
9.7 Mordells conjecture . . .
9.8 Exercises . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
60
.
.
.
.
62
62
65
67
71
.
.
.
.
.
72
72
74
77
78
81
.
.
.
.
.
.
82
82
85
88
90
91
93
.
.
.
.
.
.
.
.
94
94
94
96
98
100
102
105
105
10 Prime numbers
107
10.1 Introductory remarks . . . . . . . . . . . . . . . . . . . . . . . . . 107
10.2 Elementary methods . . . . . . . . . . . . . . . . . . . . . . . . . 111
10.3 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
11 Irrationality and transcendence
11.1 Irrationality . . . . . . . . . . .
11.2 Transcendence . . . . . . . . . .
11.3 Irrationality of (3) . . . . . . .
11.4 Exercises . . . . . . . . . . . . .
F.Beukers, Elementary Number Theory
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
117
117
120
122
124
CONTENTS
125
143
143
146
147
147
150
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Chapter 1
Integers and the Euclidean
algorithm
1.1
Integers
1.1. INTEGERS
Although divison of one number by another usually fails we do have the concept
of division with remainder.
Theorem 1.1.3 (Euclid) Let a, b N with a > b. Then either b|a or there
exist q, r N such that
a = bq + r,
r < b.
Moreover, q, r are uniquely determined by these (in)equalities.
Proof. Suppose b does not divide a. Consider all multiples of b which are less
than a. This is a non-empty set, since b < a. Choose the largest multiple and
call it bq. Then clearly a bq < b. Conversely, if we have a multiple qb such that
a bq < b then qb is the largest b-multiple < a. Our theorem follows by taking
r = a bq.
2
Another important concept in the natural numbers are prime numbers. These
are natural numbers p > 1 that have only the trivial divisors 1, p. Here are the
rst few:
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, . . .
Most of us have heard about them at a very early age. We also learnt that there
are innitely many of them and that every integer can be written in a unique way
as a product of primes. These are properties that are not mentioned in our rules.
So one has to prove them, which turns out to be not entirely trivial. This is the
beginning of number theory and we will take these proofs up in this chapter.
In the history of arithmetic the number 0 was introduced after the natural
numbers as the symbol with properties 0 a = 0 for all a and a + 0 = a
for all a. Then came the negative numbers -1,-2,-3,. . . with the property that
1 + 1 = 0, 2 + 2 = 0, . . .. Their rules of addition and multiplication are
uniquely determined if we insist that these rules obey the commutative, associate
and distributive laws of addition and multiplication. Including the infamous
minus times minus is plus which causes so many high school children great
headaches. Also in the history of mathematics we see that negative numbers
and their arithmetic were only generally accepted at a surprisingly late age, the
beginning of the 19th century.
F.Beukers, Elementary Number Theory
From now on we will assume that we have gone through all these formal introductions and we are ready to work with the set of integers Z, which consists of
the natural numbers, their opposites and the number 0.
The main role of Z is to have extended N to a system in which the operation
of subtraction is well-dened for any two elements. One may proceed further by
extending Z to a system in which also element (= 0) divides any other. The
smallest such system is well-known: Q, the set of rational numbers. At several
occasion they will also play an important role.
1.2
Definition 1.2.1 Let a1 , . . . , an Z, not all zero. The greatest common divisor
of a1 , . . . , an is the largest natural number d which divides all ai
Notation: (a1 , . . . , an ) or gcd(a1 , . . . , an ).
Definition 1.2.2 Two numbers a, b Z, not both zero, are called relatively
prime if gcd(a, b) = 1.
Theorem 1.2.3 Let ai Z (i = 1, . . . , n) not all zero. Let d = gcd(a1 , . . . , an ).
Then there exist t1 , . . . , tn Z such that d = a1 t1 + + an tn
Proof. Consider the set
S = {a1 x1 + + an xn | x1 , , xn Z}
and choose its smallest positive element. Call it s. We assert that d = s. First
note that every element of S is a multiple of s. Namely, choose x S arbitrary.
Then x ls S for every l Z. In particular, x [x/s]s S. Moreover,
0 x [x/s]s < s. Because s is the smallest positive element in S , we have
necessarily x [x/s]s = 0 and hence s|x. In particular, s divides ai S for every
i. So s is a common divisor of the ai and hence s d. On the other hand we
know that s = a1 t1 + + an tn for suitable t1 , , tn . From d|ai i follows that
d|s. Hence d s. Thus we conclude d = s.
2
Corollary 1.2.4 Assume that the numbers a, b are not both zero and that a1 , . . . , an
are not all zero.
i. Every common divisor of a1 , , an divides gcd(a1 , . . . , an ).
Proof: This follows from Theorem 1.2.3. There exist integers t1 , . . . , tn such
that gcd(a1 , . . . , an ) = a1 t1 + + an tn . Hence every common divisor of
a1 , . . . , an divides their greatest common divisor.
F.Beukers, Elementary Number Theory
1.3
In this section we describe a classical but very ecient algorithm to determine the
gcd of two integers a, b and the linear combination of a, b which yields gcd(a, b).
First an example. Suppose we want to determine (654321,123456) . The basic
idea is that gcd(a, b) = gcd(a rb, b) for all r Z. By repeatedly subtracting
the smallest term from the largest, we can see to it that the maximum of the
numbers between the gcd brackets decreases. In this way we get
=
=
=
=
=
=
So we see that our greatest common divisor is 3. We also know that there exist
integers x, y such that 3 = 654321x + 123456y. To obtain such numbers we have
to work in a more schematic way where we have put a = 654321, b = 123456,
654321 = 1a + 0b
123456 = 0a + 1b
37041 = 1a 5b
12333 = 3a + 16b
42 = 10a 53b
27 = 2933a + 15545b
15 = 2943a 15598b
12 = 5876a + 31143b
3 = 8819a 46741b
0 = 123456a + 654321b
In the left hand column we have rewritten the subtractions. In the righthand
column we have written all remainders as linear combinations of a = 654321 and
b = 123456.
In general, write r1 = a en r0 = b and inductively determine ri+1 for i 0 by
ri+1 = ri1 [ri1 /ri ]ri until rk+1 = 0 for some k. Because r0 > r1 > r2 > 0
such a k occurs. We claim that rk = gcd(a, b). This follows from the following
observation, gcd(ri , ri1 ) = gcd(ri , ri1 [ri1 /ri ]ri ) = gcd(ri , ri+1 ) = gcd(ri+1 , ri )
for all i. Hence gcd(b, a) = gcd(r0 , r1 ) = gcd(r1 , r0 ) = = gcd(rk , rk+1 ) =
gcd(rk , 0) = rk .
In our example we see in the right hand column a way to write 3 as a linear
combination of a = 654321 and b = 123456. The idea is to start with 654321 =
1 a + 0 b and b = 0 a + 1 b and combine these linearly as prescribed by
the euclidean algorithm. We obtain consecutively the ri as linear combination of
654321 and 123456 until
3 = 8819 654321 46741 123456.
In general, let ri (i 1) be as above and suppose rk = 0 and ri = 0 (i < k).
Let
x1 = 1, y1 = 0, x0 = 0, y0 = 1
and inductively,
xi+1 = xi1 [ri1 /ri ] xi ,
(i 0).
10
In principle this implies that the number of steps required in the euclidean algorithm can be as large as the number a or b itself. This would be very bad if
the numbers a, b would have more than 15 digits, say. However, the very strong
point of the euclidean algorithm is that the number of steps required is very
small compared to the size of the starting numbers a, b. For example, 3100 1
and 2100 1 are numbers with 48 and 31 digits respectively. Nevertheless the
euclidean algorithm applied to them takes only 54 steps. Incidently, the gcd is
138875 in this case. All this is quantied in the following theorem.
Theorem 1.3.1 Let a, b N with a > b and apply the euclidean algorithm to
them. Use the same notations as above and suppose that rk is the last non-zero
remainder in the algorithm. Then
k<2
log a
.
log 2
1.4
Definition 1.4.1 A prime number is a natural number larger than 1, which has
only 1 and itself as positive divisor.
Usually the following theorem is taken for granted since it is basically taught at
elementary school. However, its proof requires some work and is an application
of Corollary 1.2.4(iv).
Theorem 1.4.2 (Fundamental theorem of arithmetic) Any integer larger
than 1 can be written uniquely, up to ordering of factors, as the product of prime
numbers.
F.Beukers, Elementary Number Theory
11
Proof. First we show that any n N>1 can be written as a product of primes.
We do this by induction on n. For n = 2 it is obvious. Suppose n > 2 and
suppose we proved our assertion for all numbers below n. If n is prime we are
done. Suppose n is not prime. Then n = n1 n2 , where 1 < n1 , n2 < n. By our
induction hypothesis n1 and n2 can be written as a product of primes. Thus n is
a product of primes.
We now prove our theorem. Let n be the smallest number having two dierent
prime factorisations. Write
n = p1 p2 pr = q 1 q 2 q s ,
where pi , qj are all primes. Notice that p1 |q1 qs . Hence according to Corollary 1.2.4(iv), p1 |qt for some t. Since qt is prime we have p1 = qt . Dividing out
the common prime p1 = qt on both factorisations we conclude that n/p1 has also
two dierent factorisations, contradicting the minimality of n.
2
The proof of the above theorem relies on Corollary 1.2.4 of Theorem 1.2.3. The
latter theorem relies on the fact that Z is a euclidean domain. In Theorem 13.2.3
we have given the analogue of Theorem 1.2.3 for general euclidean domains and in
principle it is possible to prove a unique prime factorisation property for arbitrary
commutative euclidean domains. We have not done this here but instead refer to
standard books on algebra.
Definition 1.4.3 Let a1 , . . . , an Z be non-zero. The lowest common multiple
of a1 , . . . , an is the smallest positive common multiple of a1 , . . . , an .
Notation: lcm(a1 , . . . , an ) or [a1 , . . . , an ].
The following lemma is a straightforward application of Theorem 1.4.2,
Lemma 1.4.4 Let a, b N be non-zero. Write
a = pk11 pk22 pkr r ,
mr
1 m2
b = pm
1 p 2 pr ,
gcd(a, b) = p1
r ,mr )
pmin(k
r
and
max(k1 ,m1 )
lcm(a, b) = p1
r ,mr )
pmax(k
.
r
Proof. Excercise.
Another fact which is usually taken for granted is that there are innitely many
primes. However, since it does not occur in our Axioms, we must give a proof.
Theorem 1.4.5 (Euclid) There exist innitely many primes.
Suppose that there exist only nitely many primes p1 , . . . , pn . Consider the number N = p1 pn + 1. Let P be a prime divisor of N . Then P = pi for some i
and pi |(p1 pn + 1) implies that pi |1. This is a contradiction, hence there exist
innitely many primes.
2
F.Beukers, Elementary Number Theory
12
1.5
Exercises
13 + 23 + + n3 = (1 + 2 + + n)2 (use
y = y0 at
1.5. EXERCISES
13
1. Show that the equation has a solution if and only if gcd(a, b) divides c.
2. Describe the full solution set of the equation.
3. Solve the equation 105x + 121y = 3 in x, y Z completely.
Exercise 1.5.12 Let a, b N and suppose a > b. Choose r, q Z such that
a = bq + r and 0 r < b.
a) Show that r < a/2.
Consider now the euclidean algoritm with the notations from the course notes.
Let rk be the last non-zero remainder.
14
Chapter 2
Arithmetic functions
2.1
Definitions, examples
In number theory we very often encounter functions which assume certain values
on N. Well-known examples are,
i. The unit function e dened by e(1) = 1 and e(n) = 0 for all n > 1.
ii. The identity function E dened by E(n) = 1 for all n N.
iii. The power functions Ik dened by Ik (n) = nk for all n N. In particular,
E = I0 .
iv. The number of prime divisors of n, denoted by (n).
v. The number of distinct prime divisors of n, denoted by (n).
vi. The divisor sums l dened by
l (n) =
dl .
d|n
(n)x = x
n=1
k=1
15
(1 xk )24 .
16
ix. The sums of squares function rd (n) given by the number of solutions
x1 , . . . , xd to n = x21 + + x2d .
In general,
Definition 2.1.1 An arithmetic function is a function f : N C.
Of course this is a very broad concept. Many arithmetic functions which occur
naturally have interesting additional properties. One of them is the multiplicative
property.
Definition 2.1.2 Let f be an arithmetic function with f (1) = 1. Then f is
called multiplicative if f (mn) = f (m)f (n) for all m, n with (m, n) = 1 and
strongly multiplicative if f (mn) = f (m)f (n) for all m, n.
It is trivial to see that examples e, E, Il , 2 are strongly multiplicative and that
2 is multiplicative. In this chapter we will show that l and are multiplicative.
The multiplicative property of Ramanujans is a deep fact based on properties
of so-called modular forms. It was rst proved by Mordell in 1917. As an aside we
also mention the remarkable congruence (n) 11 (n)(mod 691) for all n N.
The multiplicative property of r2 (n)/4 will be proved in the chapter on sums of
squares.
Theorem 2.1.3
pl(ki +1) 1
i
pl 1
Proof. Part i. The proof is based on the fact that if d|mn and (m, n) = 1 then
d can be written uniquely in the form d = d1 d2 where d1 |m, d2 |n. In particular
d1 = (m, d), d2 = (n, d). We have
(d1 d2 )l
dl =
l (mn) =
d1 |m,d2 |n
d|mn
dl1
dl2
d1 |m
d2 |n
= l (m)l (n)
Part ii. It suces to show that l (pk ) = (pl(k+1) 1)/(pl 1) for any prime power
pk . The statement then follows from the multiplicative property of l . Note that,
l (pk ) = 1 + pl + p2l + + pkl =
pl(k+1) 1
.
pl 1
2
17
2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203,
2281, 3217, 4253, 4423, 9689, 9941, 11213, 19937, 21701,
23209, 44497, 86243, 110503, 132049, 216091, 756839, 859433,
1257787, 1398269, 2976221, 3021377, 6972593, 13466917,
20996011, 24036583, 25964951, 30402457, 32582657,
37156667, 42643801, 42643801, 43112609
At the moment (August 2008) 243112609 1 is the largest known prime. For the
latest news on search activities see: www.mersenne.org.
An equally classical subject is that of amicable numbers that is, pairs of numbers
m, n such that n is the sum of all divisors of m less than m and vice versa. In
F.Beukers, Elementary Number Theory
18
other words, m+n = (n) and n+m = (m). The pair 220, 284 was known to the
ancient Greeks. Euler discovered some 60 pairs (for example 11498355, 12024045)
and later computer searches yielded several thousands of new pairs, some of which
are extremely large.
2.2
Convolution, M
obius inversion
(f g)(n) =
f (d)g(n/d).
d|n
f (d)g
(f g)(mn) =
d
d|mn
(
)
mn
f (d1 d2 )g
=
d1 d2
d1 |m d2 |n
(
(
)
)
m
n
f (d1 )g
=
f (d2 )g
d1
d2
d1 |m
d2 |n
= (f g)(m)(f g)(n).
2
Notice that for example l = E Il . The multiplicative property of l follows
directly from the mulitiplicativity of E and Il . We now introduce an important
multiplicative function.
Definition 2.2.3 The Mobius function (n) is dened by (1) = 1, (n) = 0 if
n is divisible by a square > 1 and (p1 pt ) = (1)t for any product of distinct
primes p1 , . . . , pt .
Notice that is a multiplicative function. Its importance lies in the following
theorem.
F.Beukers, Elementary Number Theory
2.2. CONVOLUTION, MOBIUS
INVERSION
19
Theorem 2.2.4 (M
obius inversion) Let f be an arithmetic function and let
F be dened by
F (n) =
f (d).
d|n
F (d)
d|n
(n)
d
d|pk
= 1 1 + 0 + + 0 = 0.
2
Theorem 2.2.5 Let be the Euler -function. Then,
i.
n=
(d),
n 1.
d|n
ii. is multiplicative.
iii.
(n) = n
(
p|n
1
1
p
)
.
Proof. Part i). Fix n N. Let d|n and let Vd be the set of all m n such
that (m, n) = d. After dividing everything by d we see
that |Vd | = (n/d).
Since
{1, . . . , n} = d|n Vd is a disjoint union we nd that n = d|n (n/d) = d|n (d),
as asserted.
Part ii). We have seen in part i) that I1 = E . Hence, by Mobius inversion,
= I1 . Multiplicativity of automatically follows from the multiplicativity
of and I1 .
Part iii). Because of the multiplicativity of it suces to show that (pk ) =
pk (1 1/p). This follows from (pk ) = (I1 )(pk ) = pk pk1 = pk (1 p1 ). 2
F.Beukers, Elementary Number Theory
20
2.3
Exercises
Exercise 2.3.1 Prove that the sum of the inverses of all divisors of a perfect
number is two.
Exercise 2.3.2 Prove that an odd perfect number must contain at least three
distinct primes.
(It is known that there must be at least six distinct primes).
Exercise 2.3.3 Describe the multiplicative functions which arise from the following convolution products (the symbol 2 stands for the multiplicative function
2(n) ).
Ik Ik
I1
2 2
Exercise 2.3.4 Prove that there exist innitely many n such that (n) + (n +
1) = 0.
Exercise 2.3.5 Prove that there exist innitely many n such that (n) + (n +
1) = 1.
Exercise 2.3.6 Let F be the multiplicative function such that F (n) = 1 if n
is a square, and 0 otherwise. Determine a multiplicative function f such that
f E = F.
Exercise 2.3.7 Let f be a multiplicative function. Prove that there exists a
multiplicative function g such that f g = e (hence the multiplicative functions
form a group with respect to the convolution product).
Exercise 2.3.8 Prove that for every n N
2
0 (k) .
0 (k)3 =
k|n
k|n
Exercise 2.3.9 (**) Show that there exist innitely many n such that (n) is a
square.
Chapter 3
Residue classes
3.1
Basic properties
Definition 3.1.1 Let m N. Two integers a and b are called congruent modulo
m if m|a b.
Notation: a b(mod m)
Definition 3.1.2 The residue class a mod m is dened to be the set {b Z | b
a(mod m)}. The set of residue classes modulo m is denoted by Z/mZ.
The following properties are more or less straightforward,
Remark 3.1.3 Let a, b, c, d Z and m, n N.
i. a a + rm(mod m) r Z.
ii. There are m residue classes modulo m.
iii. a b(mod m) and n|m a b(mod n).
iv. a b(mod m) and c d(mod m) a + c b + d(mod m), ac
bd(mod m).
v. Let P (x) Z[x]. Then a b(mod m) P (a) P (b)(mod m).
vi. The residue classes modulo m form a commutative ring with 1-element.
Its additive group is cyclic and generated by 1 mod m. If m is prime then
Z/mZ is a nite eld. If m is composite then Z/mZ has divisors of zero.
Definition 3.1.4 Let m N. A residue class a mod m is called invertible if
x mod m such that ax 1(mod m). The set of invertible residue classes is
denoted by (Z/mZ) .
21
22
Notice that (Z/mZ) is nothing but the unit group of Z/mZ. In particular the
inverse x mod m of a mod m is uniquely determined modulo m.
Theorem 3.1.5 Let a Z en m N. Then,
a mod m is invertble (a, m) = 1.
Proof. The residue class a mod m is invertible x : ax 1(mod m)
x, y : ax + my = 1 (a, m) = 1.
2
Notice that the proof of the latter theorem also shows that we can compute
the inverse of a residue class via the euclidean algorithm. For example, solve
331x 15(mod 782). The euclidean algorithm shows that the g.c.d. of 331 and
782 is 1 and 1 = 189 331 + 80 782. Hence 189 mod 782 is the inverse of
331 mod 782. To solve our question, multiply on both sides with 189 to obtain
x 293(mod 782).
3.2
23
1jr
cj nj Mj .
j=1
x 2(mod 6),
x 3(mod 7).
First of all notice that 5, 6 and 7 are pairwise relatively prime and so, according to
the chinese remainder theorem there is a unique residue class modulo 567 = 210
as solution. However, in the following derivation this will follow automatically.
The rst equation tells us that x = 1 + 5y for some y Z. Substitute this
into the second equation, 1 + 5y 2(mod 6). Solution of this equation yields
y 5(mod 6). Hence y must be of the form y = 5 + 6z for some z Z.
For x this implies that x = 26 + 30z. Substitute this into the third equation,
26 + 30z 3(mod 7). Solution yields z 6(mod 7). Hence z = 6 + 7u, u Z
which implies x = 206 + 210u. So the residueclass 206 mod 210 is the solution to
our problem. Notice by the way that 206 4(mod 210). If we would have been
clever we would have seen the solution x = 4 and the solution to our problem
without calculation.
F.Beukers, Elementary Number Theory
24
3.3
In this section we shall give a description of the group (Z/mZ) and a number
of properties. With the notations of Theorem 3.2.2 we know that Z/mZ
Z/m1 Z Z/mr Z. This automatically implies the following corollary.
Corollary 3.3.1 Let notations be the same as in Theorem 3.2.2. Then,
(Z/mZ) (Z/m1 Z) (Z/mr Z) .
Definition 3.3.2 Let m N. The number of natural numbers m relatively
prime with m is denoted by (m), Eulers totient function.
Notice that if m 2 then (m) is precisely the cardinality of (Z/mZ) . We recall
the following theorem which was already proved in the chapter on arithmetic
functions. However, the multiplicative property follows also directly from the
chinese remainder theorem. So we can give a separate proof here.
Theorem 3.3.3 Let m, n N.
a) If (m, n) = 1 then (mn) = (m)(n).
c)
d|n (d) = n.
Proof. Part a) follows directly from Corollary 3.3.1 which implies that (Z/mnZ)
(Z/mZ) (Z/nZ) . Hence |(Z/mmZ) | |(Z/mZ) | |(Z/nZ) | and thus
(mn) = (m)(n).
Part b) First note that (pk ) = pk pk1 for any prime p and any k N. It is
simply the number of integers in [1, pk ] minus the number of multiples of p in the
same interval. Then, for any n = pk11 pkr r we nd, using property (a),
(n) =
(pki i )
i=1
(pki i pki i 1 ) = n
i=1
(1
=
#{k|1 k n, (k, n) = d}
d|n
d|n
(n/d) =
d|n
d|n
(d)
1
).
pi
25
26
Not all values of m allow a primitive root. For example, the order of each elements
in (Z/24Z) is 1 or 2, whereas this group contains 8 elements. To get a good
impression of (Z/mZ) one should take the prime decomposition m = pk11 pkr r
of m and notice that according to Corollary 3.3.1
(Z/mZ) (Z/pk11 Z) (Z/pkr r Z) .
The structure for the groups (Z/pk Z) with p prime and k N is then given in
the following two theorems.
Theorem 3.3.9 Let p be an odd prime and k N. Then (Z/pk Z) is a cyclic
group.
Proof. For k = 1 the theorem is just Theorem 3.3.7. So let us assume k > 1.
Let g be a primitive root modulo p and let ord(g) be its order in (Z/pk Z) . Since
g ord(g) 1(mod pk ) we have g ord(g) 1(mod p). Moreover, g is a primitive root
modulo p and thus (p 1)|ord(g). So h = g ord(g)/(p1) has order p 1 in (Z/pk Z) .
k1
From Lemma 3.3.11(i) with r = k it follows that (1 + p)p 1(mod pk ) and the
k2
same lemma with r = k 1 implies (1 + p)p
1 + pk1 1(mod pk ). Hence
ord(1 + p) = pk1 . Lemma 13.1.6 now implies that (p + 1)h has order (p 1)pk1
and so (Z/pk Z) is cyclic.
2
Theorem 3.3.10 Let k Z3 . Any element of (Z/2k Z) can be written uniquely
in the form (1)m 5t mod 2k with m {0, 1}, 0 t < 2k2 .
Note that this theorem implies that (Z/2k Z) is isomorphic to the product of a
cyclic group of order 2 and a cyclic group of order 2k2 when k 3. Of course
(Z/4Z) and (Z/2Z) are cyclic.
Proof. From Lemma 3.3.11(ii) with r = k we nd 52
1(mod 2k ) and with
2k3
k1
k
r = k 1 we nd 5
1+2
1(mod 2 ). So, ord(5) = 2k2 . Notice that
all elements 5t , 0 t < 2k2 are distinct and 1(mod 4). Hence the remaining
elements of (Z/2k Z) are given by 5t , 0 t < 2k2 .
2
k2
i. (1 + p)p
r2
ii. 52
1 + pr (mod pr+1 ).
(1 + p)p
1 + pr1 (mod pr ).
pr1
(1 + p)
= 1+
p ( )
p
t=1
1 + pAp
Because p is odd we have
27
(p)
2
r1
(1 + p)p
t
r1
(Apr1 )t
( )
p
+
(Apr1 )2 (mod pr+1 ).
2
as asserted.
ii. Use induction on r. For r = 2 our statement is trivial. Let r > 2 and assume
we proved
r3
52 1 + 2r1 (mod 2r ).
r3
In other words, 52
52
r2
3.4
1
= 0./14285/7.
7
Using Eulers Theorem 3.3.4 this is easy to see. Note that 106 1 is divisible by
7 and 106 1 = 7 142857. Then,
142857
1
= 6
= 142857 106 + 142857 1012 +
7
10 1
The second equality is obtained by expanding 1/(106 1) = 106 /(1 106 ) in
a geometrical series.
F.Beukers, Elementary Number Theory
28
N
.
1
10r
After expansion into a geometrical series we see that 10k has a purely periodic
decimal expansion and that has a periodic expansion. In particular, when the
denominator of is relatively prime with 10 we can take k = 0 and the expansion
of is purely periodic in this case.
To prove the last part of the theorem we make two observations. Let again r
be the order of 10 in (Z/qZ) and let l be the minimal period of the decimal
expansion. From the rst part of the above proof it follows that q divides 10l 1.
In other words, 10l 1(mod q) and hence r|l. From the second part of the proof
it follows that r is a period of the decimal expansion, hence l|r. Thus it follows
that r = l.
2
The above theorem is stated only for numbers written in base 10. It should be
clear by now how to formulate the theorem for numbers written in any base.
F.Beukers, Elementary Number Theory
3.5. EXERCISES
3.5
29
Exercises
x 5(mod 21)
x 7(mod 25)
4y 5(mod 35)
z 4(mod 21)
6y 2(mod 11)
z 18(mod 35).
+
.
M
2 3 4
1317 1318 1319
Show that 1979 divides N . Generalise this.
F.Beukers, Elementary Number Theory
30
Exercise 3.5.12 Write the explicit isomorphism between Z/10Z and Z/2Z
Z/5Z.
Exercise 3.5.13 a) Prove that 13|(42
9
b) Prove that 37/|x9 + 4 x N.
2n+1
3) n N.
m=1
(m,n)=1
1
m = n(n).
2
0 if n N is even
(1)n/d (d) =
n if n N is odd
d|n
3.5. EXERCISES
31
Exercise 3.5.32 Let q be an odd prime and n N. Show that any prime divisor
p of nq1 + + n + 1 satises either p 1(mod q) or p = q. Using this fact
show that there exist innitely many primes which are 1 modulo q.
Exercise 3.5.33 Determine all primitive roots modulo 11. Determine all primitive roots modulo 121.
Exercise 3.5.34 a) Determine all primitive roots modulo 13, 14 and 15 respectively.
b) Solve the following equations: x5 7(mod 13), x5 11(mod 14), x5
2(mod 15).
Exercise 3.5.35 Suppose that (Z/mZ) is cyclic. Prove that m = 2, 4, pk or 2pk ,
where p is an odd prime and k N. (Hint: use Exercise 3.5.14)
Exercise 3.5.36 Suppose that p and q = 2p + 1 are odd primes. Prove that
p1
(1) 2 2 is a primitive root modulo q.
Exercise 3.5.37 Show that 22 1 is divisible by at least t distinct primes.
t
32
Exercise 3.5.38 In the decimal expansion of 1/5681 the 99-th digit after the
decimal point is a 0. Prove this.
Exercise 3.5.39 What is the 840-th digit after the decimal point in the decimal
expansion of 1/30073?
Exercise 3.5.40 What is the 165-th digit after the decimal point in the decimal
expansion of 1/161?
Exercise 3.5.41 (Lehmers prime test). Let a, n N be such that
an1 1(mod n) and
n1
p
Chapter 4
Primality and factorisation
4.1
34
2(mod N )
22 4(mod N )
2 42 32(mod N )
2 322 2048(mod N )
201135347146(mod N ).
The number of steps required by this method is precisely the number of binary
digits of N 1 which isproportional to log N . For large N this is extremely
small compared to the N steps required by the naive method. By the way,
we see that 2N 1 1(mod N ), hence N is composite (it will turn out that
N = 369181 555029). So Theorem 4.1.1 can be considered as a compositeness
test. What to do if we had found 2N 1 1(mod N ) instead? We cannot conclude
that N is prime. We have for example 2560 1(mod 561), whereas 561 = 31117.
But we can always choose other a and repeat the test. If aN 1 1(mod N ) for
several a, we still cannot conclude that N is prime. It is becoming more likely,
but not 100% certain. In fact there exist N such that aN 1 1(mod N ) for
all a with (a, N ) = 1. These are the so-called Carmichael numbers. Examples
are 561, 1729, 294409, . . .. There exist 2163 Carmichael numbers below 25 109 .
It was an exciting surprise when Granville, Pomerance and Red Alford showed
around 1991 that there exist innitely many of them.
A criterion which gives better chances (but not certainty) in recognising primes
is based on the following renement of Fermats little theorem.
Theorem 4.1.2 Let p be an odd number and a Z such that p |a. Write
p 1 = 2k m with m odd and k 0. Suppose p is prime. Then,
either am 1(mod p)
or i such that a2 m 1(mod p) and 0 i k 1.
i
ap1 a2
1(mod p).
35
Suppose that am 1(mod p). Let r be the smallest non-negative integer such
r
r1
that a2 m 1(mod p). Notice that 1 r k. Then a2 m 1(mod p).
r1
r1
By the minimality of r we cannot have a2 m 1(mod p). Hence a2 m
1(mod p) and since 0 r 1 k 1 our assertion follows.
2
The contrapositive statement can be formulated as follows.
Theorem 4.1.3 (Rabin test) Let N N be odd and a Z such that N /
|a.
Write N 1 = 2k m with k 0 and m odd. If
am 1(mod N )
and
0ik1 : a2 m 1(mod N )
i
(4.1)
then N is composite.
If a satises property (4.1) we shall call a a witness to the compositeness of
N . Unlike the converse to Fermats little theorem the Rabin test allows no
Carmichael-like numbers N . This is garantueed by the following theorem
Theorem 4.1.4 Let N N be odd and composite. Among the integers between
1 and N at least 75% is a witness to the compositeness of N .
Proof. It suces to prove that at least 75% of the numbers in (Z/N Z) is a
witness. We shall do this for all N = 9. For N = 9 the theorem is directly veried
by hand. Let S be the union of the solution sets of the equations xm 1(mod N )
i
and x2 m 1(mod N )(i = 0, . . . , k 1) respectively. It suces to show that
|S| is at most (N )/4.
j
Let j be the largest number with 0 j k 1 such that x2 m 1(mod N ) has
a solution. Such a j exists since we have trivially (1)m 1(mod N ). Notice
j
that S is contained in the set of solutions of x2 m 1(mod N ). Now apply
Lemma 4.1.5 to see that there are at most (N )/4 such solutions.
2
Lemma 4.1.5 Let N be an odd composite positive integer, not equal to 9. Let
M |(N 1)/2. Suppose that xM 1(mod N ) has a solution x0 . Then the
number of solutions to xM 1(mod N ) in x (Z/N Z) is less than or equal
to (N )/4.
Proof. Let N = pk11 pkr r be the prime factorisation of N . Notice that the
number of solutions to xM 1(mod N ) equals the numbers of solutions to xM
1(mod N ), a bijection being given by x 7 xx0 (mod N ). The total number of
solutions is equal to
The equality follows from the fact that, since M |(N 1), prime factors of N
cannot divide M . For every prime p dividing N we know that xM 1(mod p)
F.Beukers, Elementary Number Theory
36
has a solution, hence ord(x) divides 2M but not M . This implies (M, p 1) =
ord(x)/2 (p 1)/2.
Suppose that N has at least three distinct prime factors. Then,
pi 1
1
(N )
2 (M, pi 1) 2
(pi 1)
.
2
4 i
4
i
i
Suppose that N has precisely two distinct prime factors, p and q say. First
suppose that N = pq. There exist e, f N such that p 1 = 2e(M, p 1) and
q 1 = 2f (M, q 1). Suppose e = f = 1. From e = 1 follows that (p 1)/2
divides M which in its turn divides (N 1)/2 = (pq 1)/2. Hence (p 1)/2
divides (q 1)/2. Similarly it follows from f = 1 that (q 1)/2 divides (p 1)/2.
Hence p = q, which is impossible. So we must assume ef 2. But then,
2(M, p 1)(M, q 1) = 2
(p 1)(q 1)
(p 1)(q 1)
(N )
=
.
4ef
4
4
Now suppose that N has two primes p, q and is divisible by p2 , say. Then,
2(M, p 1)(M, q 1)
2(p 1)(q 1)
(N )
(N )
.
4
2p
4
(N )
(N )
.
k1
p
4
2
37
Fn is prime 3
Fn 1
2
1(mod Fn ).
38
In 1644 The French monk Marin Mersenne stated that 2n 1 is prime for the
values
n = 2, 3, 5, 7, 13, 17, 19, 31, 67, 127, 257
and composite for all other n < 257. It was clear that Mersenne had not tested
all these numbers. It was only in 1750 when Euler veried that 231 1 is prime.
It also turned out that Mersenne was wrong about n = 67, 257 and that he had
forgotten to add n = 61, 89, 107 to his list. The number 2127 1 was proven to be
prime in 1876 by Lucas and until 1952 this remained the largest known prime. For
further details and more on prime numbers see the Web page primes.utm.edu.
For the following values of n the number Mn is now (2013) known to be prime:
n=
2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203,
2281, 3217, 4253, 4423, 9689, 9941, 11213, 19937, 21701,
23209, 44497, 86243, 110503, 132049, 216091, 756839, 859433,
1257787, 1398269, 2976221, 3021377, 6972593, 13466917,
20996011, 24036583, 25964951, 30402457, 32582657,
37156667, 42643801, 43112609, 57885161
4.2
In recent years, starting from the 1980s, several powerful primality tests have
been invented. We mention the test of Adleman,Rumely,Lenstra and Cohen,
which uses Gauss sums (see the chapter on Gauss sums) and tests which use the
addition structure on elliptic curves and abelian varieties. These methods are
still used in practice.
Despite all these ingeneous developments it still was not clear whether there exists a primality test whose runtime is polynomial in the number of digits of the
number to be tested. This changed in July 2002. An Indian computer scientist,
M.Agrawal and two of his students, N.Kayal and N.Saxena, had discovered a
polynomial time primality test. This was a historical breakthrough in the theory of factorisation and primality proving. Another remarkable feature of their
F.Beukers, Elementary Number Theory
39
discovery was its elementary nature. The original ingredients were some modular arithmetic with polynomials and a deep theorem in analytic number theory.
However, through the eorts of H.W.Lenstra jr, the analytic number theory part
has been replaced by a property of prime numbers which will actually be proved
in these course notes.
To show that the algorithm is quite simple we give it here is pseudo-code.
Input: integer n > 1
1. If n = ab for a N and b > 1:
output Composite
2. Find the smallest r N such that ordr (n) > 4(log n)2 .
3. If 1 < gcd(a, n) < n for some a r:
output Composite
4. If n r, output Prime
4.3
Factorisation methods
The test of Rabin, described in the previous section, enables one to decide compositeness of a number N without knowing anything about the prime decomposition of N . In this section we make a few remarks about the problem of factoring
numbers. First of all, factoring a number is much harder than proving its compositeness. Another feature of factorisation algorithms is that they mostly give
a positive chance of success, but not certainty. Factorisation methods with 100%
of success are the naive method and the algorithm of Sherman-Lehman. However
they are both very slow with runtimes O(N 1/2 ) and O(N 1/3 ) respectively. One
therefore prefers the probabilistic methods with the losophy that if you happen
F.Beukers, Elementary Number Theory
40
(4.2)
(4.3)
for some l < k. If condition (4.3) is fullled we have actually found a factor of N .
Let p be a prime divisor
of N . We assert that the probability to nd p using this
algorithm with k < 2pis larger than 1/2. Since a composite number N always
has a prime divisor < N , the expected run-time of our algorithm is therefore
O(N 1/4 ).
Here is a heuristic argument which supports our assertion. Consider the sequence
x0 , x1 , x2 , . . . modulo p. Then practical experience suggests that if b = 0, 2, this
sequence behaves randomly modulo p. People are unable to prove this but it
seems like a good principle. Let q N. Being a random sequence, the probability
that the elements x0 , x1 , . . . , xq mod p are all distinct is
1
2
q
(1 )(1 ) (1 ).
p
p
p
Suppose that q >
2p. Then
1
2
q
r
log(1 )(1 ) (1 ) =
log(1 )
p
p
p
p
r=1
r
r=1
1 q(q + 1)
< 1
2
p
when q > 2p the probality that two elements in x0 , . . . , xq mod p are equal
is larger than1/2. In other words, if we are moderately lucky we will nd
0 l < k 2p such that xk xl (mod p). Note by the way, that the above
argument is an example of the so-called birthday paradox.
If we carry out the algorithm as described above, we would have to store the
elements xi of our sequence to verify (4.3). Moreover, testing all l < k with
F.Beukers, Elementary Number Theory
41
exist l < k < 2p satisfying xk xl (mod p). By its very construction, the
sequence {xi mod p}
i=0 will be periodic from the index l onward with period
k l. In particular, choose M N such that k > M (k l) l. Then we have
by the periodicity, x2M (kl) xM (kl) (mod p) and
we nd that p|(x2i xi , N ) for
i = M (k l). Notice that i = M (k l) < k < 2p.
A second option is to compute the sequence of xi (mod N ) and whenever we hit
upon i being a power of 2 we save it as the number A. At every iteration we
check whether 1 < gcd(xi A) < N . Suppose that from the index l onward the
sequence xi (mod p) becomes periodic with period k l. Choose r minimal such
that 2r max l, k l, then there exists i with i < 2r+1 such that xi x2r
xi A 0(mod p).
It should also be noted that instead of xk+1 = x2k + b we could have chosen any
other recurrence which has a chance of producing random sequences modulo N .
Our choice is simply the simplest we could think of.
In many large factorisation programs one factors out small prime factors by native
trial division for primes up to 109 , say. As a second step one often uses the Pollard
rho method to nd moderately small prime factors up to, say 1014 .
The factorisation algorithms which are the most powerful at the moment (2006)
are the quadratic sieve of Pomerance (1984, to be discussed in the next section),
the elliptic curve method of Lenstra (1984), the Number Field Sieve (1990) by
the Lenstras, Manasse and Pollard and variations on these methods. Typically,
these methods do not garantuee 100% success in factoring a number, and their
run-time analysis is again based on probability arguments. But most of the time
they are very successful.
4.4
From time to time even Fermat was forced to factor large numbers during his
calculations. Of course he also stumbled upon the near impossibility of fcatoring
large numbers. However, Fermat did make a few observations which enabled his
to factor certain large numbers quickly. One such example is N = 8051. Fermat
noticed that this is the dierence of two squares, 8051 = 902 72 and he got
8051 = (90 7)(90 + 7) = 83 97.
This idea can
be formalised as follows, which we call2 the method 2of Fermat.
Choose r = [ N ] and test if one of the numbers (r + 1) N, (r + 2) N, (r +
3)2 N, . . . is a square. If this is the case, say (r + k)2 N = m2 then we have
N = (r + k)2 m2 = (r + k m)(r + k + m) and thus a factorisation. The
dierence between the factors is 2m. This means that if N = ab with a < b, then
F.Beukers, Elementary Number Theory
42
m = (b a)/2. Hence
k = 0, 1, 2, 3, . . .
43
The idea is now to choose factorisation on the right hand side such their product is
a square. For example the products corresponding to k = 19, 9, 15 multiplied
yield a square. Explicitly,
(r 19)2 23 53 13(mod N )
(r 9)2 25 3 5 13(mod N )
(r + 15)2 24 33 52 (mod N )
Multiplication of these congruences yields
(r 19)2 (r 9)2 (r + 15)2 (26 32 53 13)2 (mod N )
We have two dierent squares, equal modulo N . Let us see if this gives a factor
of N ,
gcd(N, (r 19)(r 9)(r + 15) 26 32 53 13) = gcd(123889, 40982373) = 541
We were lucky and found N = 541 229.
From this example the principle of the method can be deduced. We rst nd
suciently many k so that (r + k)2 N consists of prime factors B. By
sucient we mean: at least two more values than the number of primes B,
preferably more. Linear algebra over Z/2Z tells us that we can choose from these
numbers a set whose product is a square. By taking this product modulo N we
nd a relation of the form X 2 Y 2 (mod N ), from which we hope to deduce a
factorisation. The relationship with linear algebra can be seen from our example.
The factorisation table we gave before can be depicted schematically as follows.
k 1 2
19 1 1
17 1 0
9
1 1
0
0 0
0 0
1
7
0 1
15
0 0
3
0
0
1
1
0
1
1
5
1
0
1
1
1
0
0
7
0
0
0
0
0
0
0
11
0
0
0
0
0
0
0
13
1
0
1
0
0
1
0
44
and c = 2. The reader can verify that limN L(N )/N = 0 for every > 0. So
the runtime is not exponential, we call this a sub-exponential algorithm.
One of the bottle-necks of the algorithm is that for each (r + k)2 N it must be
decided if it consists of prime factors B. It was Pomerances idea to replace this
by a sieving process, hence the name quadratic sieve. We work with a sequence
of number ak which we initially choose to be (r + k)2 N . For every prime
p B we do the following. Solve (r + x)2 N (mod p) and let x1 , x2 be two
solutions with x1 x2 (mod p). For every k with with k x1 , x2 (mod p) we
replace ak by ak /p. Having done all this, we pick those k fro which ak = 1. For
these k the number (r + k)2 N consists only of primes B. Strictly speaking
we must also sieve for higher powers of p, but we leave this aside for the sake of
simplicity. The saving in runtime is tremendous, the runtime is now L(N ) instead
of L(N )2 . As a rule of thumb we choose B < L(N )b and |k| < L(N )a for suitable
0.1 < a, b < 1, depending on the implementation. A big advantage of the sieving
technique is that it can be distributed easily over dierent machines. To give an
idea, A.K.Lenstras factorisation of RSA-129 (129 decimals) was distributed over
1600 computers, mostly workstations and PCs. The number of primes for which
there was sieved was 524339, about half a million. The lienar algebra part was
the solution of a system of linear equations modulo 2 in half a million variables.
This work must be done on a central computer.
4.5
a with (a, N ) = 1.
45
Suppose we want to deduce the secret key l from the public key k. This could be
done as follows. Factorise N = pq, determine = (p 1)(q 1) and determine
l by solving kl 1(mod ). Notice that in order to determine we need the
factorisation of N . No other methods are known. If however the secret primes p, q
contain about 100 digits, factorisation of N with the known methods is practically
impossible within a human or even universal lifetime. So the success of the RSAcryptosystem is based on the apparent inability of mathematicians to factor large
numbers.
Of course the above idea can be applied in the opposite direction. We then have
the possibility of electronic signatures. Let us sketch a very simplied application. An individual, say Peter, makes or buys his own secret/public key pair.
The public key is known to, say, a savings bank and the private key is securely
guarded by Peter. Suppose Peter wants to transfer $10,000.- from the bank to a
furniture shop electronically. He might write an electronic message saying My
name is Peter, please transfer $10,000.- to the account of furniture shop so and
so. Unfortunately anyone could do this in Peters name with undesirable consequences for Peter. The solution is that Peter encrypts his message with his
private code and appends it to the message written in plain text. The bank then
decodes the scrambled message with the public key and observes that the result
corresponds with Peters plain text. Since no one else but Peter could have encrypted the message succesfully, the bank is convinced of the validity of Peters
message and carries out his order.
Other applications of modular arithmetic and the near impossibility to factor
large numbers are protocols by which one can prove that one possesses certain
information, a password for example, without revealing that information. Such
protocols are known as zero-knowledge proofs. . One such procedure, known as
identity proof, has been devised by Goldwasser,Micali and Racko in 1985.
Suppose Vincent calls Vera over the telephone and Vincent wants to convince Vera
that it is really him, which Vera must then verify. Of course Vincent can mention
a password, only known to him and Vera, to identify himself. However, there is
always the possibility of eavesdroppers. Another problem might be that Vincent
considers Vera too sloppy to conde his password to. Both these problems are
solved by using a zero-knowledge proof.
Just as above we let N be the product of two very large primes p and q. The secret
password of Vincent, only known to him, is a number a between 1 and N . The
name by which Vincent is known publicly is A, determined by A a2 (mod N )
and 1 < A < N . The identication protocol runs as follows. Vincent takes a
random number x and sends the square X x2 (mod N ) to Vera. Then Vera can
ask either of two questions,
i. send x
ii. send ax
F.Beukers, Elementary Number Theory
46
If Vincent is really Vincent he can of course do that and Vera can check that
x2 X(mod N ) in case i) and that (ax)2 AX(mod N ) in case ii).
What if an impostor tries to pass himself as Vincent? Before sending anything
he may try to guess Veras question. If he guesses i) then he can take any x send
X mod N and answer Veras question with x. If he guesses ii) he can take any
x, send A1 X mod N and answer Veras question with x. In any case the chance
for the imposter to make the right guess is 1/2. However, if this question and
answer game is repeated a hundred times, say, the chance that the impostor is
not exposed as a fraud is (1/2)100 . This is small enough for Vera to be convinced
of Vincents identity if all questions are answered correctly. Notice that in the
process the value of a has not been revealed by Vincent.
Another possibility for the imposter is to infer Vincents password a from A. He
would have to solve x2 A(mod N ) and the only known way to do this is to
solve the equivalent system x2 A(mod p), x2 A(mod q). Taking square
roots modulo a prime is doable in practice (see chapter on quadratic reciprocity)
so it seems we are done. Unfortunately we need the factorisation of N again and
this turns out to be the bottleneck in solving x2 A(mod N ). Again the safety
of Vincents password relies on our inability to factor very large numbers.
Chapter 5
Quadratic reciprocity
5.1
( ) 1
if a is quadratic residue mod p
a
1 if a is quadratic nonresidue mod p
=
p
0
if p|a
Theorem 5.1.3 Let p be an odd prime and a, b Z. Then
a) There are exactly
residues mod p.
p1
2
b) (Euler)
( )
p1
a
a 2 (mod p).
p
c)
( )( ) ( )
a
b
ab
=
.
p
p
p
47
p1
2
quadratic non-
48
( )
1
= 1,
p
1
p
{
=
1
if p 1(mod 4)
1 if p 1(mod 4)
( )2
Proof. Part a). Consider the residue classes 12 , 22 , . . . , p1
mod p. Since a2
2
(a)2 (mod p) these are all quadratic residues modulo p. They are also distinct,
from a2 b2 (mod p) would follow a b(mod p) and when 1 a, b p1
2
this implies a = b. So there are exactly p1
quadratic
residues
modulo
p.
The
2
remaining p 1 p1
= p1
residu classes are of course quadratic nonresidues .
2
2
Part b) Clear if a 0(mod p). So assume a 0(mod p). Since (a(p1)/2 )2
ap1 1(mod p) by Fermats little theorem we see that a(p1)/2 1(mod p).
Suppose that a is a quadratic residue , i.e. x such that x2 a(mod p). Then
1 xp1 (x2 )(p1)/2 a(p1)/2 (mod p), which proves half of our assertion.
Since we work in the eld Z/pZ, the equation x(p1)/2 1(mod p) has at most
p1
solutions. We know these solutions to be the p1
quadratic residues . Hence
2
2
(p1)/2
a
1(mod p) for any quadratic nonresidue a mod p.
Part c)
( )( )
( )
p1 p1
p1
a
b
ab
a 2 b 2 (ab) 2
(mod p).
p
p
p
Because
(
) ( ) Legendre
( ) symbols can only be 0, 1 and p 3, the strict equality
a
b
= ab
follows.
p
p
p
( )
( )
5.2
p1
2
Quadratic reciprocity
One might wonder for which prime numbers the numbers 3 and 5 ,say, are
quadratic residue . Euler, Legendre and Gauss have occupied themselves with
this question. For example it turns out that
( )
( )
3
3
= 1 if p 1(mod 12)
= 1 if p 5(mod 12)
p
p
and
( )
5
= 1 if p 1(mod 5)
p
( )
5
= 1 if p 2(mod 5).
p
Starting from such observations Euler conjectured the quadratic reciprocity law
(see Theorem 5.2.6). Legendre gave an incomplete proof of it and later Gauss
managed to give several complete proofs. In this chapter we give a proof which
is basically a version given by Eisenstein. In the chapter on Gauss sums we shall
give another proof.
F.Beukers, Elementary Number Theory
49
!a 2 (1)
!(mod p).
2
2
p1
2
After division by ( p1
)! we obtain
(1) mod p and after using Theo2
( ) a
rem 5.1.3(b) we conclude that ap = (1) .
2
= #{n even|
Replace n by
p+1
2
n to obtain
= #{n | 1 n
[
]
p+1
=
4
p+1
}
4
50
( )
p2 1
2
= (1) 8 .
p
as
S(a, p) =
.
p
s=1
( )
a
= (1)S(a,p) .
p
( )
Proof. According to Gauss lemma we have ap = (1) where is the number
Then
a mod p. Let 1 s p1
. If
of negative residue classes among a, 2a, . . . , p1
2
2
p1
sa
sa mod p is a positive residue class we write sa = [ p ]p + us with 1 us 2 . If
sa mod p is a negative residue class we write sa = [ sa
]p+pus with 1 us p1
.
p
2
p1
A straightforward check shows that {u1 , u2 , . . . , u p1 } = {1, 2, . . . , 2 }. Addition
2
of these equalities yields
]
2 [
sa
p1
p1
sa = p
s=1
s=1
p1
+ p +
(us ).
s=1
p1
s S(a, p) + +
s=1
us (mod 2)
s=1
p1
S(a, p) + +
s (mod 2).
s=1
The summations
on both sides cancel and we are left with S(a, p) (mod 2)
( )
a
2
hence p = (1) = (1)S(a,p) .
Theorem 5.2.6 (Quadratic reciprocity law) Let p, q be two odd prime numbers. Then
( )( )
p1 q1
p
q
= (1) 2 2 .
q
p
( )
( )
Alternatively pq = pq unless p q 1(mod 4), in which case we have
( )
( )
p
q
=
.
q
p
F.Beukers, Elementary Number Theory
51
p1q1
.
2
2
To see this, picture the rectangle [0, p/2] [0, q/2] and the lattice points (m, n)
N2 with 1 m p1
, 1 n q1
inside it. The diagonal connecting (0, 0) and
2
2
(p/2, q/2) does not pass through any of the lattice points. Notice that the number
of lattice points below the diagonal is precisely S(q, p) and above the diagonal
q1
lattice points, hence our assertion follows.
S(p, q). In total there are p1
2
2
We can now combine our assertion with Lemma 5.2.5 to obtain
( )( )
p1 q1
p
q
= (1)S(p,q)+S(q,p) = (1) 2 2 .
q
p
2
5.3
It is known that Gauss gave six (more or less) dierent proofs of the quadratic
reciprocity law. Since then the number of proofs has increased dramatically to an
estimated 200. The proof we have given above is essentially due to Eisenstein. In
P.Bachmann, Die Lehre von der Kreistheilung, de Gruyter, Berlin, Leipzig, 1921
q1 p1
2
2
(q 1)!(p1)/2 ).
52
which equals
(p 1)!
(q1)/2
/q
(p1)/2
(p 1)!
(q1)/2
( )
q
(mod p).
p
5.4
Applications
The rst equation is equivalent to x2 1(mod 4), which is solvable. Multiply the
second by 13 on both sides to obtain x(2 +14x
+8
)
( ) 0(mod 19). After splitting o
3
squares, (x + 7)2 3(mod 19). Since 19
= 19
= 1, the second congruence
3
equation, and hence the original one, is not solvable.
Example 3. Let p be an odd prime. Then,
( ) {
3
1
if p 1(mod 3)
=
1 if p 1(mod 3).
p
This follows from
( ) ( )( )
(p) (p)
p1
p1
3
1
3
=
.
=
= (1) 2 (1) 2
p
p
p
3
3
Since 1 is a quadratic residue modulo 3 and 1 a quadratic nonresidue our
assertion follows.
F.Beukers, Elementary Number Theory
5.4. APPLICATIONS
53
=
=
=
=
=
=
111 = 3 37
41 271
239 4649
21649 513239
53 79 265371653
2071723 5363222357
1(mod Fn ).
32
Fn
3
3
F.Beukers, Elementary Number Theory
54
The numbers Fn are known as the Fermat numbers, see the chapter on applications of congruences for more on the primality of Fn .
Theorem 5.4.3 (Lucas, Lehmer) For any n N let Mn = 2n 1. Dene
S1 , S2 , . . . by the recursion
S1 = 4
Sk+1 = Sk2 2,
k 0.
a + p3 b 3(mod p).
Proof. Since p is a prime we have, using Fermats little Theorem 3.3.5,
55
2n2
The second equivalence
follows
by
multiplication
with
(2
+
3)
and using the
fact that (2 + 3)(2 3) = 1. The proof of our theorem now comes down to
proving that
n1
Mn is prime (2 + 3)2
1(mod Mn ).
M
3
n
3 1 3(mod Mn ).
(1 + 3) 1 +
Mn
Thus we nd,
n
(1 + 3)2 (1 + 3)Mn (1 + 3) (1 3)(1 + 3) 2(mod Mn ). (5.1)
On the other hand,
n
n1
n1
n1
n1
(1+ 3)2 (1+ 3)22
(4+2 3)2
22 (2+ 3)2 (mod Mn ). (5.2)
Since 2 is a quadratic residue modulo Mn , we have
n1
22
(5.3)
5.5
( 111 )
To determine the Legendre symbol 137
say, we must rst factor 111 before being
able to apply quadratic reciprocity. This( is all right)for small numbers like 111,
11111111111
? (197002597249 is prime)
but what to do if we want to compute 197002597249
F.Beukers, Elementary Number Theory
56
=
n
p1
p2
pr
( )
where the symbols m
are the Legendre symbols.
pi
( )
Remark 5.5.2 Note that if m
= 1 then x2 m(mod n) is not solvable
n
2
simply
( m ) because x m(mod pi ) is not solvable for some i. 2On the other hand,
anything about the solubility of x m(mod n). For
if n = (1 we
) cannot say
1
2
example, 21 = 1 but x 1(mod 21) is certainly not solvable.
However, we do have the following theorem.
Theorem 5.5.3 Let n, m be odd positive integers. Then,
i)
ii)
iii)
1
n
)
= (1)
n1
2
( )
n2 1
2
= (1) 8
n
(m) ( n )
n
= (1)
m1 n1
2
2
Proof. These statements can be proved by using the corresponding theorems for
the Legendre symbol and the observation that for any r-tuple of odd numbers
u1 , . . . , ur we have
ur 1
u 1 ur 1
u1 1
+ +
(mod 2).
2
2
2
(5.4)
To be more precise, the sum on the left of (5.4) is modulo 2 equal to the number k
of ui which are 1(mod 4). If k is even, the product u1 ur is 1(mod 4) and the
term on the right of (5.4) is also even. If k is odd, we have u1 ur 1(mod 4),
hence the term on the right of (5.4) is also odd.
F.Beukers, Elementary Number Theory
57
= (1) 2 ++ 2
n
p1
pr
and
p1 1
pr 1
p1 pr 1
n1
+ +
(mod 2).
2
2
2
2
Similarly, ii) follows from
( ) ( )
( )
p2
p2
2
2
2
r 1
1 1
=
= (1) 8 ++ 8
n
p1
pr
and
p21 1
p2 1
(p1 pr )2 1
n2 1
+ + r
(mod 2).
8
8
8
8
Let m = q1 qs be the prime factorisation of m. Then iii) follows from
(m) ( n ) ( q ) (p )
pj 1 qi 1
i
j
=
= (1) i,j 2 2
n
m
pj
qi
i,j
and
p j 1 q i 1 q i 1 pj 1
m1n1
(mod 2).
2
2
2
2
2
2
i,j
i
j
2
( 11111111111 )
The computation of 197002597249 can now be done using a euclidean-like algorithm and Theorem 5.5.3. Notice that
197002597249 = 17 11111111111 + 8113708362
8113708362 = 2 4056854181
11111111111 = 2 4056854181 + 2997402749
...
...
Hence,
(
) (
)
11111111111
197002597249
=
197002597249
11111111111
(
) (
)(
)
8113708362
2
4056854181
=
=
11111111111
11111111111
( 11111111111 )
11111111111
=
=
4056854181
We keep repeating these steps of inversion and extraction of factors 2 until we
nd the value of the Jacobi symbol to be 1. From this algorithm we see that
F.Beukers, Elementary Number Theory
58
59
e := 0
loop:
Choose t Z0 minimal such that g 2 = 1.
t
If (t > 0) g := gb2
st
If (t == 0) stop
By using this algorithm with g = x2 am1 we can determine the value of 2j in
Tonellis algorithm quickly.
5.6
Class numbers
Take an odd prime p > 3 and consider the sum of quadratic residues
a.
R=
1ap1,a residue mod p
(p1)/2
k=1
1
k 2 p(p 1)(2p 1) 0(mod p).
6
Also,
R+N
p1
1
a p(p 1) 0(mod p).
2
a=1
5 7
0 1
11
1
13
0
17
0
19
1
23
3
29
0
31
3
37
0
41
0
43
1
47
5
53
0
59
3
This table suggests that (N R)/p is always 0 and 0 if and only if p 1(mod 4).
Suppose rst that p 1(mod 4). If a is a residue modulo p, the same holds for
p a. So the quadratic residues mod p come in pairs and there are (p 1)/4
such pairs. Moreover, the sum of each pair is p, hence R = p(p 1)/4. The
same argument shows that N = p(p 1)/4. This conrms our expectation that
N R = 0 if p 1(mod 4). Proving that (N R)/p > 0 if p 3(mod 4)
is far more dicult however. A well-known proof by Dirichlet uses arguments
from complex function theory. Here is a table of values when p 3(mod 4) and
p < 200.
p
(N R)/p
7 11
1 1
19
1
23
3
31
3
43
1
47
5
59
3
67
1
71
7
79
5
83
3
103
5
60
127
5
131
5
139
3
151
7
163
1
167
11
179
5
191
9
199
9
When
[ p ] 3(mod 4) we call (N R)/p the class-number of the ring O =
Z 1+ 2 p . Notation: h(p). These class numbers form the tip of an iceberg,
which is the eld of quadratic forms, arithmetic in quadratic elds and Dirichlet L-series. For example, the interest of this class number lies in the fact that
h(p) = 1 if and only if we have unique factorisation in irreducibles in O. It was
already suspected by Gauss that the biggest p for which h(p) = 1 is p = 163.
This was only proved in the 1950s by Heegner, Stark and later, in the 1960s via
other methods, by A.Baker.
5.7
Exercises
( 105 )
131
3
p
= 1 if p
5.7. EXERCISES
61
114(mod 127)
61(mod 93)
47(mod 101)
47(mod 143)
837(mod 2996)
0(mod 58)
2x + 3(mod 175).
Exercise 5.7.8 For which prime numbers is 5 a quadratic residue ? Same question for 3 and 3.
Exercise 5.7.9 Let a Z and p, q two odd (
primes
) (not) dividing a. Prove,
a
a) If a 1(mod 4) then: p q(mod |a|) p = aq .
( ) ( )
b) If a 1(mod 4) then: p q(mod 4|a|) ap = aq .
Exercise 5.7.10 Let p be a prime which is 1 modulo 4. Let a be a quadratic
residue modulo p. Prove that a solution of x2 a(mod p) is given by x = a(p+1)/4 .
Exercise 5.7.11 Let p be a prime which is 5 modulo 8. Let r be an element
of (Z/pZ) of order 4 and let a be a quadratic residue modulo p. Prove that a
solution of x2 a(mod p) is given by either x = a(p+3)/8 or x = ra(p+3)/8 .
Exercise 5.7.12 Prove that there exist innitely many primes p such that p
1(mod 4). Prove that there exist innitely many primes p such that p 1(mod 4).
Exercise 5.7.13 Let p be an odd prime. Let a be the smallest positive integer
p2 1
[ p] + [ 2p] + + [ kp] =
.
12
b) Let p = 4k + 3 be prime. Prove,
(p 1)(p 2)
.
[ p] + [ 2p] + + [ kp]
12
(Hint: count the number of lattice points below the parabola y = px with x < p/4
and use in b) that N K.)
Chapter 6
Dirichlet characters and Gauss
sums
6.1
Characters
(g) = 0.
gG
62
6.1. CHARACTERS
63
(g) =
(hg) = (h)
(g).
gG
gG
gG
To get a good grasp on the characters of an abelian group we consider the vectorspace V = C|G| consisting of |G|-tuples of complex numbers (cg1 , cg2 , . . .) indexed by the elements g1 , g2 , . . . of G. On V we dene a complex inner product
by
(x, y ) =
xg y g
gG
for any x = (xg1 , xg2 , . . .), y = (yg1 , yg2 , . . .) in V . The bar denotes complex
conjugation. We let any h G act on V by
hx = (xhg1 , xhg2 , . . .).
So we see that any h simply permutes the coordinates of x in a way prescribed
by the groupstructure. In particular, the elements of G act as unitary (=length
preserving) linear maps on V . Let be a character on G. We dene the corresponding charactervector v by
v = ((g1 ), (g2 ), . . .)
in other words, v is just the sequence of values of . Notice that for any h G,
hv = ((hg1 ), (hg2 ), . . .) = (h)((g1 ), (g2 ), . . .) = (h)v .
Hence v is a common eigenvector for all h G with eigenvalues (h). Conversely, any common eigenvector v of all h G denes a character on G by
taking the eigenvalue of each h as charactervalue. Let hv = (h)v and suppose we had taken g1 = e. Then h(ve , . . .) = (vh , . . .) and, on the other hand,
h(ve , . . .) = (h)(ve , . . .) = ((h)ve , . . .). Hence vh = (h)ve for all h G. So
v = ve ((g1 ), (g2 ), . . .). In particular, v is uniquely dened up to a scalar factor.
Finally, let 1 , 2 be two distinct characters. In particular, 1 2 = 1 1
2 is not
the trivial character. Then, using Lemma 6.1.3,
(v1 , v2 ) =
1 (g)2 (g) =
(1 2 )(g) = 0,
gG
gG
64
Proof. Since, by the above remarks, character vectors belonging to distinct characters are orthogonal, there cannot be more than |G| characters. Suppose that we
have k distinct characters and that k < |G|. Then the orthogonal complement U
in V of the character vectors has dimension |G| k > 0. Moreover, every element
h G is unitary and hence maps U into itself. From linear algebra we know
that any set of commuting unitary operators has a common eigenvector, which
in its turn denes a character of G, distinct from the ones we already had. So
we now have k + 1 distinct characters. We continu this procedure untill we have
|G| distinct characters.
2
Lemma 6.1.5 Let G be a nite abelian group and g G not the identity element.
Then,
(g) = 0.
|G|. Hence M is |G| times a unitary matrix. In such a matrix the columns
are orthogonal as well, in other words for any distinct g, h G we have
(g)(h) = 0.
( )
i. The Legendre symbol p. on (Z/pZ) for odd primes p and the Jacobi
symbol on (Z/mZ) for odd m. Both examples are real characters of order
two.
ii. The character of order four on (Z/13Z) given by
a: 1 2 3
4 5 6 7 8 9 10 11 12 (mod 13)
(a) : 1 i 1 1 i i i i 1 1 i 1
One easily veries that (ab) = (a)(b) for all a, b (Z/13Z) . We have
constructed this character by assigning (2) = i. Since 2 is a primitive root
modulo 13, the powers of 2 run through (Z/13Z) and we can determine
the character values correspondingly.
F.Beukers, Elementary Number Theory
65
1
3
5
7
1 1
1 1
1 1 1
1
1
1 1 1
6.2
{
pnx
x=1
1
if p/
|n
p 1 if p|n
Proof. Clearly, when p|n all terms in the summation are 1, so the second case
follows immediately. In the rst case we use the summation formula for geometric
sequences to obtain
(ppn pn )/(pn 1) = 1.
p1
(x)px .
x=1
p1
2
p.
66
p1
(x)(y)1 px+y .
x,y=1
p1
(z)(y)(y)1 py(z+1) .
z,y=1
The factors (y) cancel. According to Lemma 6.2.1 summation over y now yields
1 if z 1(mod p) and p 1 if z 1(mod p). Hence,
S S1 = (1)p
p1
(x).
x=1
The summation on the right vanishes according to Lemma 6.1.3 and we have
proved assertion a).
Part b) First of all, notice that
S1 =
p1
(x)1 px
x=1
p1
(x)
(x)p
x=1
= (1)
p1
(x)
(x)p
x=1
= (1)S .
Hence |S |2 = S S = (1)S S1 and assertion b) follows by using assertion
a).
c) If is the Legendre symbol we have = 1 and hence, via assertion a),
2
S2 = (1)p = (1)(p1)/2 p.
Definition 6.2.4 Let 1 , 2 be Dirichlet characters modulo p, where p is an odd
prime. The Jacobi sum J(1 , 2 ) is dened by
J(1 , 2 ) =
p1
x=2
1 (x)2 (1 x).
6.3. APPLICATIONS
67
p1
1 (x)2 (y)px+y .
x,y=1
1 (x)2 (y)p(x+y) +
p1 p1
xy
u=1 v=2
p1 p1
p1
x=1
u=1 v=2
The rst summation vanishes because of Lemma 6.1.3 and the fact that 1 2 =
0 . In the second summation the sum over u yields S1 2 and summing over v
yields J(1 , 2 ). Hence S1 S2 = J(1 , 2 )S1 2 .
2
Corollary 6.2.6 Let notations be as in Denition 6.2.4. Suppose that the char
acters are not each others inverse. Then |J(1 , 2 )| = p.
Proof. This follows from Theorem 6.2.5 and Theorem 6.2.3(b).
6.3
Applications
A nice application of Gauss sums is a short proof of the quadratic reciprocity law.
Let p, q be two odd primes. Write p = S where is the Legendre symbol on
(Z/pZ) . The following calculations will be performed in Z[p ] considered modulo
q. Using Theorem 6.2.3(c) and Eulers Theorem 5.1.3(b) we nd that
( )
p1
q1
p1 q1
p
q1
q
p p p ((1) 2 p) 2 p (1) 2 2
p (mod q).
q
On the other hand,
pq
( p1 ( )
x
x=1
)q
px
F.Beukers, Elementary Number Theory
68
p1 ( )
pqx
( )
)
p1 (
q
qx
pqx
p x=1 p
p
x=1
(
)
q
p (mod q).
p
(mod q)
q
p
p1
2
p. We then
( )
Using the above idea we can also compute p2 . The following calculation will
be performed in Z[i] modulo p. We consider (1 + i)p (mod p) and compute it in
two ways. First of all
{
p1
1 + i(mod p)
if p 1(mod 4)
p
p
(1 + i) 1 + i 1 + (1) 2 i
i(1 + i)(mod p) if p 3(mod 4)
On the other hand, since (1 + i)2 = 2i,
(1 + i) (2i)
p
p1
2
( )
2 p1
(i + 1)
i 2 (1 + i)(mod p).
p
p1
p+1
p
i i 2 (1) 4 if p 3(mod 4)
( )
One now easily checks that
3(mod 8).
2
p
= 1 if p 1(mod 8) and
( )
2
p
= 1 if p
Theorem 6.3.1 Let p be a prime with p 1(mod 4). Then p can be written as
the sum of two squares. More precisely, p = a2 + b2 with
)
2 (
x(x2 1)
p1
a=
x=1
)
2 (
x(x2 )
p1
b=
x=1
6.3. APPLICATIONS
69
p1 ( x(x2 1) )
x=0
p1
(
4 (x)
x=1
1x
p
p1
a = J =
4 (y )
y=1
1 y2
p
)
2 ( )(
y
1 y2
p1
y=1
)
2 (
y(y 2 1)
p1
y=1
p1
ib = iJ =
4 (y )
y=1
1 y 2
p
)
2 ( )(
y
1 y 2
p1
= 4 ()
y=1
)
2 (
y(y 2 )
p1
= 4 ()
y=1
70
x Z : x3 2(mod p) A, B Z : J(, ) = A + 3B 3
where we have put A = a b/2, B = b/6.
p1
x=1
p1
p3x 1(mod 3)
x=1
6.4. EXERCISES
71
p1
x=1
1
(4)
p1
(4x)p4x (mod 2)
x=1
(2)S (mod 2)
Our congruence mod 2 follows after multiplication by S , Theorem 6.2.3(a) and
p 1(mod 2).
2
6.4
Exercises
Exercise 6.4.1 Determine all Dirichlet characters modulo 7 and modulo 12.
Exercise 6.4.2 Choose a character 4 of order 4 and a character 2 of order 2
on (Z/13Z) . Give a table in which x, 2 (x), 4 (x) and 2 (x)4 (1 x) are listed
for x = 1, . . . , 12. Compute the Jacobi sum J(2 , 4 ). Note that it is a number
in Z[i] and that its norm is 13.
Exercise 6.4.3 Proof that a cyclic group of order N has precisely N characters,
which again form a cyclic group.
Exercise 6.4.4 Let p be an odd prime. Prove that there exists a Dirichlet character of order 4 if and only if p 1(mod 4).
Exercise 6.4.5 Let p be a prime and a Z, not divisible by p. Suppose p
2(mod 3). Prove that x3 a(mod p) has precisely one solution modulo p.
Exercise 6.4.6 Determine all solutions of x3 2(mod p) for p = 19, 31. Check
also if p can be written in the form p = a2 + 27b2 .
Chapter 7
Sums of squares, Warings
problem
7.1
In previous chapters we have already seen that if an odd prime divides the sum of
two relatively prime squares, it is 1(mod 4). Moreover, Fermat showed that any
prime 1(mod 4) can be written as a sum of two squares. Furthermore it was
observed since antiquity that any positive integer can be written as the sum of
four squares. This was proved by Lagrange for the rst time in 1770. Problems
such as these form the subject of this section. It should be noted explicitly here
that by a square we mean the square of a number in Z. So, 02 is also considered
to be a square.
The quickest and most elegant way to deal with the above mentioned problems
is to work in the rings of Gaussian integers and quaternionic integers where
we rely heavily on the fact that they are euclidean domains. There exist also
presentations of this subject which work entirely in Z. However, they are in fact
a disguised form of application of the euclidean algorithm.
Theorem 7.1.1 (Fermat) Let p be an odd prime. Then p is a sum of two
squares if and only if p 1(mod 4).
Proof. Suppose p = x2 + y 2 for some x, y Z. Since squares are either 0 or 1
mod 4, p, being odd, can only be 1(mod 4).
Now suppose that p 1(mod 4). Then the congruence equation x2 1(mod p)
has a solution, x0 say. Let us now work in Z[i] and use unique factorisation. We
have p|(x20 + 1) hence p|(x0 + i)(x0 i). If p were prime in Z[i] we would have
p|(x i) and, via complex conjugation, p|(x + i). Hence p|2i, which is impossible.
Hence p = in Z[i] with N , N > 1. Take norms on both sides, p2 = N N .
Since N , N > 1 this implies p = N , hence p can be written as a sum of two
squares.
2
72
73
k + 1
r2 (pk ) 0
=
4
1
1
if
if
if
if
p 1(mod 4)
p 3(mod 4), k odd
p 3(mod 4), k even
p=2
k
aj bj i. Let rj=1 i = = a + bi. Notice that n = rj=1 pj j = rj=1 N (j ) =
N () = a2 + b2 . Since we have dierent choices for each j we will get dierent
solutions to n = x2 + y 2 . We have seen that we get essentially all solutions in this
way. As an example we write 65 as sum of two squares. Notice that 65 = 5 13
F.Beukers, Elementary Number Theory
74
7.2
(7.1)
In the remainder of the proof b|a means: c q such that a = cb. First of all,
|p N |p2 N = 1, p or p2 . Secondly, |(1 + xi + yj) N |(1 + x2 + y 2 )
N < 2 (p/2)2 + 1 < p2 . Hence N = 1 or p. Suppose N = 1. Then, according
to Theorem 13.4.4 is a unit. Multiply Eq.(7.1) on both sides from the right by
(1 xi yj) to obtain (1 xi yj) = (1 xi yj)p + (1 + x2 + y 2 ). Since
F.Beukers, Elementary Number Theory
75
p|(1 + x2 + y 2 ) we infer p|(1 xi yj) and hence p|(1 xi yj), which is clearly
impossible. Thus we conclude that N = p and p is a sum of four squares.
2
Not everyone may be charmed by quaternions and for this reason we give Lagranges original proof of Theorem 7.2.1 as well.
Proof. Just as in the previous proof we note that it suces to prove that every
prime p can be written as the sum of four squares. This is a consequence of
Eulers identity,
(a2 + b2 + c2 + d2 )(a2 + b2 + c2 + d2 ) =
= (aa + bb + cc + dd )2
+(ab ba + cd dc )2
+(ac bd ca + db )2
+(ad + bc cb da )2 .
Just as above, we can nd x, y such that x2 +y 2 +1 0(mod p) and |x|, |y| p/2.
We then have x2 + y 2 + 1 = m0 p and m0 ((p/2)2 + (p/2)2 + 1)/p < p.
Let m be the smallest positive integer such that mp can be written as the sum
of four squares. We will show that m > 1 leads to a contradiction. Suppose
mp = a2 + b2 + c2 + d2
and m > 1.
(7.2)
r 0,
(7.3)
(7.4)
Notice that in the proof of (7.4) we have used the assumption m > 1. Now
multiply (7.2) and (7.3) and use Eulers identity to obtain
mp mr = (a2 + b2 + c2 + d2 )(A2 + B 2 + C 2 + D2 ) = 2 + 2 + 2 + 2
F.Beukers, Elementary Number Theory
76
where
= aA + bB + cC + dD a2 + b2 + c2 + d2 0(mod m)
= aB bA + cD dC ab ab + cd cd 0(mod m)
= aC Ac + dB bD ac ac + bd bd 0(mod m)
= aD dA + bC cB ad ad + bc bc 0(mod m)
So m divides , , , and we nd rp = (/m)2 + (/m)2 + (/m)2 + (/m)2 .
We conclude that rp is a sum of four squares and 0 < r < m. This contradicts
the minimality of m. Hence we have m = 1, as desired.
2
For completeness we like to mention the following theorem,
Theorem 7.2.2 (Jacobi) Let n N. Then the number of solutions to
n = x21 + x22 + x23 + x24 ,
equals
x 1 , x2 , x3 , x4 Z
d
8
77
Proof. Let n N. Write 8n+3 as the sum of three squares, 8n+3 = a2 +b2 +c2 .
Notice that a, b, c all have to be odd. Write a = 2p 1, b = 2q 1, c = 2r 1.
Then 8n + 3 = 4(p2 p) + 4(q 2 q) + 4(r2 r) + 3 and this amounts to
( ) ( ) ( )
p
q
r
n=
+
+
.
2
2
2
(Quoting Gauss: EU REKA : num = + + !!)
( )
a
.
p
You might recognize the class number h(p) (see subsection 5.6) in this theorem.
So the number of ways in which a prime p 3(mod 8) can be written as sum of
three squares equals 24h(p).
Notice that squares can be considered as quadrangular numbers and Theorem 7.2.1
can be described cryptically as n = 2 + 2 + 2 + 2. Of course we can generalise
this and speak of pentagonal,
( ) hexagonal,... numbers. The general form of the
k-gonal numbers is (k 2) n2 +n. We mention the following theorem, conjectured
by Fermat and proven by Cauchy.
Theorem 7.2.7 (Cauchy) Any positive integer can be written as the sum of k
k-gonal numbers.
7.3
The 15-theorem
Recently Conway and Schneeberger found a remarkable theorem on the representation of integer by quadratic form. An integral quadratic form F (x1 , . . . , xr )
in r variables is a homogeneous polynomial of degree 2 with integer coecients.
It is called even if the coecients of the terms xi xj with i = j are all even.
The form F is called positive denite if F (x1 , . . . , xr ) > 0 for all choices of
(x1 , . . . , xr ) = (0, . . . , 0).
We say that a quadratic form F represents an integer if there exist integers
x1 , . . . , xr such that n = F (x1 , . . . , xr ). For example, the form x21 + x22 + x23 + x24
represents all positive integers. In 1993 Conway and Schneeberger announced the
following remarkable theorem.
F.Beukers, Elementary Number Theory
78
Theorem 7.3.1 (Conway, Schneeberger, 1993) An integral, even positive definite quadratic form represents all positive integers if and only if it represents
1, 2, 3, 5, 6, 7, 10, 14, 15.
So, if we want to show that every positive integer can be written in the form
2x2 + 2xy + y 2 + z 2 + u2 with x, y, z, u integers, all we have to do is check whether
each of the numbers 1, 2, 3, 5, 6, 7, 10, 14, 15 can be written in this way. A simple
check shows that this is indeed the case.
The proof of this theorem was quite complicated and never published. However,
in 2000 Manjul Bhargava found a simpler proof and a generalisation to all positive
quadratic forms known as the 290-theorem.
Theorem 7.3.2 (Bhargava, Hanke, 2005) An integral, positive denite quadratic
form represents all positive integers if and only if it represents
1, 2, 3, 5, 6, 7, 10, 13, 14, 15, 17, 19, 21, 22,
23, 26, 29, 30, 31, 34, 35, 37, 42, 58, 93, 110,
145, 203, 290.
7.4
Warings problem
Around 1770 Waring put forward the following question . Let k N and k 2.
Is there a number g(k) such that any positive integer is the sum of at most g(k)
non-negative k-th powers? About 140 years later, in 1909, Hilbert proved that
the answer is yes for any k 2. His method is quite complicated and we shall
not reproduce it here. Somewhat later Hardy and Littlewood developed a more
conceptual approach to the problem and showed, among other things, that there
exists g(k) 3 2k . From now on we shall denote by g(k) the smallest number
for which Warings problem is solvable. The method of Hardy and Littlewood,
and further modications and improvements of it, are known as circle methods,
which have now become a standard tool in number theory (see R.C.Vaughan,
The circle method). It is now known that g(2) = 4 (Lagrange,1770), g(3) = 9
(Wieferich,Kempner,1912), g(4) = 19 (Balusabramanian, Deshouillers, Dress,
1986), g(5) = 37 (Chen-Jingrun, 1964). For k 6 we have, if (3/2)k [(3/2)k ] >
1 (3/4)k then g(k) = [(3/2)k ] + 2k 2. It is very likely, but not quite proved
yet, that the inequality always holds.
Although g(3) = 9 it turns out that only 23 and 239 require 9 cubes, all other
numbers can be written as the sum of at most 8 positive cubes. In connection
with this we can dene G(k), the smallest integer such that any suciently large
integer can be written as the sum of at most G(k) k-th powers. Since innitely
many numbers are not the sum of three or less squares we have G(2) = 4. It is
also known that 4 G(3) 7. It is generally suspected that G(3) = 4 but no
F.Beukers, Elementary Number Theory
79
one has any idea how to prove this. By a rened version of the circle method
I.M.Vinogradov was able to show that G(k) 6k(log k +4 +log 216) and Wooley,
in 1992 improved this to G(k) k log k(1 + o(1)). Special results are G(4) = 16,
G(5) 17 (conjectured: 6), G(6) 24 (conjectured: 9), G(7) 33 (conjectured:
8), G(8) 42 (conjectured: 32), G(9) 50 (conjectured: 13), G(10) 59
(conjectured: 12) (see Vaughan and Wooley, Number Theory for the Milennium
III p301-340 A.K.Peters, 2000).
A variation on Warings problem is the following easier problem. Let k N, k
2. Does there exist a number s such that any n N can be written in the form
n = xk1 xk2 xks ?
If such an s exists we denote its minimal value by v(k). Notice that when k is
odd this question comes down to Warings problem for k-th powers of numbers
in Z.
Theorem 7.4.1 We have v(k) 2k1 + (k!)/2.
Proof. We introduce the dierence operator which acts on polynomials f (x)
by (f )(x) = f (x+1)f (x). Notice that decreases the degree of a polynomial
by one. Furthermore,
( ) (
) ( ) (
)
x
x+1
x
x
=
.
k
k
k
k1
Notice also that
(
)
( )
x
x
xk
k1
=
+ r(x)
+
2
k1
k!
k
80
C = 12t(t 1)
A3 + B 3 + C 3 = 72t(t + 1)6 .
Let n N. Choose u Q such that 1 < nu3 /72 < 2 and take t = nu3 /72. Then
A, B, C, t, t + 1 are all positive and we get
(
A
u(t + 1)2
)3
+
B
u(t + 1)2
)3
+
C
u(t + 1)2
)3
= n.
2
7.5. EXERCISES
7.5
81
Exercises
2
2
Exercise 7.5.1
Let r2 (n) be the number of solutions x, y Z to n = x + y .
Let R(X) = nX r2 (n). Prove that
R(X) = X + O( X),
Exercise 7.5.2 Find all ways to write 425 as sum of two squares.
Exercise 7.5.3 Which numbers can be written as a dierence of two squares?
Exercise 7.5.4 (H.W.Lenstra jr.) Notice, 122 + 332 = 1233, 5882 + 23532 =
5882353. Can you nd more of such examples?
Exercise 7.5.5 Let p be a prime number such that p 1, 3(mod 8). Prove
that there exist x, y Z such that p = x2 + 2y 2 . (Hint: prove that Z[ 2] is
euclidean.)
Exercise 7.5.6 a) Show that 7 cannot be written as a sum of three squares (i.e.
g(2) > 3).
b) Show that 23 and 239 cannot be written as sum of at most 8 cubes (i.e. g(3) >
8).
c) Find N N such that N cannot be written as a sum of at most 18 fourth
powers (i.e. g(4) > 18).
Exercise 7.5.7 Let g(k) be the function from Warings problem. Prove that
g(k) 2k + [(3/2)k ] 2. (Hint: consider n = 2k [(3/2)k ] 1.)
Exercise 7.5.8 We are given the identity
6(a2 + b2 + c2 + d2 )2 = (a + b)4 + (a b)4 + (c + d)4
+(c d)4 + (a + c)4 + (a c)4
+(b + d)4 + (b d)4 + (a + d)4
+(a d)4 + (b + c)4 + (b c)4 .
Prove that g(4) 53. (Hint: write n = 6N + r and N as sum of four squares.)
Rene the argument to show that g(4) 50.
Exercise 7.5.9 Show that 5 cannot be written as the sum of 4 fourth powers of
rational numbers. (Hint: look modulo 5).
Can you nd other numbers that cannot be written as sum of 4 rational fourth
powers?
Chapter 8
Continued fractions
8.1
Introduction
x1 = 1/{x0 }
a1 = [x1 ],
x2 = 1/{x1 }
......
xn+1 = 1/{xn }
an = [xn ],
......
1
1
= a0 +
x1
a1 +
1
x2
= a0 +
1
1
a1 + a2 +
which is denoted as
= [a0 , x1 ] = [a0 , a1 , x2 ] = [a0 , a1 , a2 , . . . ] .
Theorem 8.1.1 The continued fraction algorithm terminates if and only if
Q.
Proof. Suppose we have termination, i.e. {xn } = 0 for some n. Then =
[a0 , a1 , . . . , an1 ] and we see trivially that Q.
If Q then the xi are all rational numbers, say xi = pi /qi with pi , qi N and
pi > qi for all i. Notice that qi+1 = pi [pi /qi ]qi for all i, hence q1 > q2 > q3 >
> 0. So we see that the algorithm terminates.
2
82
8.1. INTRODUCTION
83
p1 = 1 p0 = a0
q1 = 0 q0 = 1
pn = an pn1 + pn2
qn = an qn1 + qn2
Then,
[a0 , a1 , . . . , an ] =
(n 0)
(n 0)
pn
.
qn
Proof. By induction on n we shall show that [a0 , . . . , an ] = (an pn1 +pn2 )/(an qn1 +
qn2 ). For n = 0 this is trivial. Now suppose n 0. Notice that
[a0 , a1 , . . . , an , an+1 ] = [a0 , a1 , . . . , an1 , an +
]
an+1
(an + 1/an+1 )pn1 + pn2
=
(an + 1/an+1 )qn1 + qn2
an+1 (an pn1 + pn2 ) + pn1
=
an+1 (an qn1 + qn2 ) + qn1
an+1 pn + pn1
=
an+1 qn + qn1
2
pn
(1)n
=
.
qn
qn (xn+1 qn + qn1 )
xn+1 pn +pn1
xn+1 qn +qn1
and a straightfor2
84
355
= 0.000000266764
113
and 355/113 approximates up to 6 decimal places. Note that there does not
seem to be any regularity in the continued fraction of .
Here are some other examples of continued fraction expansions:
e = [2, 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, 1, 1, 10, . . . ]
e2 = [7, 2, 1, 1, 3, 18, 5, 1, 1, 6, 30, 8, 1, 1, 9, 42, 11, 1, 1, . . . ]
e3 = [20, 11, 1, 2, 4, 3, 1, 5, 1, 2, 16, 1, 1, 16, 2, 13, 14, 4, 6, 2, 1, 1, 2, 2, . . . ]
2 = [1, 2, 2, 2, 2, 2, 2, . . . ]
2
It is interesting to note the regularity in the expansions of e, e
and N , but
not in e3 . We shall reurn to the periodicity of the expansion of N in the next
section.
It also turns out that if a fraction p/q satises (8.1) then it is almost a convergent
of the continued fraction of .
Theorem 8.1.5 (Legendre) Suppose R and p, q Z, q > 0 such that
p
< 1 .
q 2q 2
Then p/q is a convergent of the continued fraction of
F.Beukers, Elementary Number Theory
85
1
1
1
1
1
= a0 +
= [a0 , ].
1/
= [am1 , . . . , a1 , a0 , ]
am + 1/
8.2
86
with P, Q Z,
Proof. Let be such a quadratic irrational and write = D+P
Q
that
D + P > D P , hence P > 0. From <
0
it
follows
that
P
D < 0,
hence P < D. From > 1 we conclude
P + D > Q, hence
Q < 2 D.
87
hence > 1. From the quadratic equation we see that = pr1 /qr . Using
either pr1 /qr = (pr1 /qr1 )(qr1 /qr ) or pr1 /qr = (pr1 /pr )(pr /qr ) we conclude
that pr1 /qr < , hence 1 < < 0. So is reduced.
Suppose conversely that is a reduced quadratic irrational. Let x0 = and
recursively xn+1 = 1/(xn [xn ]). Since x0 is reduced, all xi are reduced. Moreover
their discriminants are all the same, hence there exist only nitely many distinct
xi . So there exist r < s such that xr = xs . Notice that the value of an follows
uniquely from xn+1 by the condition that xn is reduced, namely an = [1/xn+1 ].
Hence xn = [1/xn+1 ] + 1/xn+1 . In particular it follows from xr = xs that
xr1 = xs1 , etcetera, hence x0 = xsr . So the continued fraction of x0 = is
purely periodic.
Now suppose that has a periodic continued fraction. Then there exists with
a purely periodic expansion such that = [a0 , a1 , . . . , an0 , ]. We know that
is a quadratic irrational from the above, hence the same holds for . Suppose
conversely that is a quadratic irrational. Then we know that there is a reduced
such that = [a0 , . . . , an0 , ]. Since has periodic continued fraction, the
same holds for .
2
After subtraction of a0 on
both sides we obtain N = [a
0 , a1 , . . . , ar , 2a0 ], as
asserted. Notice also that N + a0 = [2a0 , a1 , a2 , . . .
, ar , N + a0 ]. Substract
2a0 on both sides to nd N a0 = [0, a1 , a2 , . . . , ar , N + a0 ]. Hence
1
= [a1 , a2 , . . . , ar , N + a0 ].
N a0
1
= [ar , . . . , a2 , a1 , a0 N ]
N + a0
1
= [ar , . . . , a2 , a1 , a0 + N ].
N + a0
F.Beukers, Elementary Number Theory
88
N + a0 = [2a0 , ar , . . . , a2 , a 1, N + a0 ].
8.3
Pells equation
N = [a0 , a1 , . . . , ar , 2a0 ]
say. Let p/q = [a0 , a1 , . . . , ar ]. Then, from our elementary estimates we nd that
p
N < 1 .
2a0 q 2
q
F.Beukers, Elementary Number Theory
89
Multiply
on
both
sides
by
|p/q
+
N
|
and
use
the
fact
that
|p/q
+
N|
(2 N + 1). We nd,
2
p
N < 2 N + 1.
q2
2a0 q 2
2 N +1
2 N +1
<
<2
2[ N ]
2( N 1)
Hence |p2 N q 2 | < 2. So we have either p2 N q 2 = 1 or p2 N q 2 = 1. (why cant
we have p2 N q 2 = 0?). In case p2 N q 2 = 1 we nd x = p, y = q as solution.
In case p2 N q 2 = 1 we notice that (p2 + N q 2 )2 N (2pq)2 = (p2 N q 2 )2 = 1.
Hence we have the solution x = p2 + N q 2 , y = 2pq.
2
Now that we established the existence of non-trivial solutions to Pells equation
we would like to have the full set. An important remark to this end is the following
trick which
by an example. Notice that 32 2 22 = 1 is equivalent
we illustrate
to (3 + 2 2)(3 2 2) = 1. Take the square on both sides and use the fact that
(3 2 2)2 = 17 12 2
Theorem 8.3.2 Choose the solution of Pells equation with x + y N > 1 and
minimal. Call it (p, q). Then,
x, y N of Pells equation there
to any solution
2
2
Proof.
Notice that if u, v Z satisfy
1u N v = 1 and u + v N 1, then
u v N , being
equal to (u + v N )
lies between 0 and 1. Addition of the
inequalities u + v N 1 and 1 u v N
> 0 implies u 0. Substraction of
these inequalities yields v > 0. We call u + v N the size of the solution
u, v.
Now
let x, y N be any solutionof Pells equation. Notice that (x + y N )(p
q N ) = (px qyN ) + (py
qx) N . Let
u = px qyN, v = py qx and we have
2
2
u N v = 1 and u + v N = (x + y N )/(p + q N ). Observe that
x+y N
< (x + y N )/2,
1
p+q N
90
performing
this operation we obtain a solution whose size is less than the size of
|x y N |
M
M
M
1
<
=
x + yM
2yM
2y
x+y N
Divide by y on both sides and use Theorem 8.1.5 to conclude that x/y is a
convergent.
2
8.4
The following story has been taken from Albert H.Beiler, Recreations in the
Theory of Numbers, Dover. It deals with a problem which is attributed to
Archimedes. In the form of an epigram one is asked for the number of oxen
of the sun. The oxen go in four colors, white, black, spotted and yellow. Let
W, X, Y, Z be the number of bulls of color white, balck, spotted, yellow respectively and x, y, z, w the number of cows. It is asked that
9
X = 20
Y +Z
W = 65 X + Z
7
Y = 13
W
+
Z
w
=
(X
+ x)
42
12
11
9
x = 20 (Y + y) y = 30 (Z + z)
13
z = 42
(W + w)
91
w = 7206360k
x = 4893246k
y = 3515820k
z = 5439213k
8.5
Cornacchias algorithm
Closely related to the previous section is the problem to write a prime number in
the form x2 + dy 2 , where d N is given. It is known for example, that p is a sum
of two squares if and only if p 1(mod 4). The question is how to nd the two
squares if p 1(mod 4). One approach would be as follows. Determine z N
such that z 2 d(mod p) by the method of the previous section. Then consider
the lattice L generated by the vectors (z, 1) and (p, 0). Moreover, for every (a, b)
L we have a2 + db2 0(mod p). Conversely, suppose that a2 + db2 = p is solvable
in integers a, b. Then it follows from a2 db2 (mod p) that a zb(mod p).
Hence either (a, b) or (a, b) is in the lattice L. Suppose (a, b) L. If we take the
norm x2 + dy 2 on L then (a, b) is a shortest vector in L and we can use reduction
in dimension 2 to nd this shortest vector.
However, the reduction algorithm with this particular application can be reformulated in an even simpler way.
Theorem 8.5.1 (G.Cornacchia,1908) Let d N and p a given odd prime.
Suppose a2 + db2 = p is solvable in the positive integers a, b. If d = 1 we assume
that a > b. Let x0 N be such that x20 d(mod p) and x0 < p/2. Apply the
following algorithm recursively, x1 = p[p/x0 ]x0 , x2 = x0 [x0 /x1 ]x1 , . . . , xi+1 =
xi1 [xi1 /xi ]xi , . . . . Choose i such that xi < p < xi1 . Then xi = a.
F.Beukers, Elementary Number Theory
92
i 1.
Notice that a0 < a1 < a2 < and that |b0 | > |b1 | > |b2 | > and that
(1)i bi > 0 as long as bi = 0. Notice also that, given ai+1 and ai , one can recover
ai1 by the conditions ai1 ai+1 (mod ai ) and 0 < ai1 < ai .
Suppose that bk = 0, which will indeed happen for some k. The algorithm
then
terminates.
Since each pair (ai , bi ), (ai1 , bi1 ) forms a basis of L, we have
ai1 bi1
= p. In particular when i = k we obtain ak bk1 = p. Hence
ai
bi
ak divides p. On the other hand, 0 a2k + db2k a2k (mod p), hence p divides
ak . So we get ak = p and bk1 = 1. Hence, from ak1 + db2k1 0(mod p)
we get a2k1 d(mod p). Starting with the values ak , ak1 we can compute
ak2 , ak3 , . . . recursively. If ak1 = x0 this will be exactly the recursion procedure
of our theorem. If ak1 = px0 , we note that ak2 = x0 , ak3 = px0 (mod x0 ) =
p(mod x0 ) and the recursion again coincides with the recursion of our theorem.
a0 . To show that a1 > p notice that |b1 | < b0 | < p/d. Moreover, a short
computation shows that a1 + db21 = ([a0 /b0 ]2 + d)p. Using b21 < p/d this implies
a21 > ([a0 /b0 ]2 + d 1)p. When d > 1 we are done. If d = 1 we know that a0 > b0 ,
hence [a0 /b0 ] 1 and we are also done.
2
In the case d = 1 the algorithm has some nice side properties. Suppose that
x0 1(mod p) and 0 < x0 < p/2. Then the continued fraction algorithm
of p/x0 is symmetric of even length. Moreover, let a and b be the rst two
8.6. EXERCISES
93
8.6
Exercises
A small point to be recalled in the following exercises is that the continued fraction
of a rational number is not unique. If we would have p/q = [a0 , . . . , ar , 1] for
example, we can rewrite it as p/q = [a0 , . . . , ar +1]. This would be the result of the
continued fraction algorithm. In the exercises we shall use the word normalised
continued fraction if we want the last partial quotient larger than 1.
Exercise 8.6.1 Let p, q N be relatively prime and such that q < p. Denote the
continued fraction of p/q by [a0 , . . . , ar ]. Let q be such that qq (1)r (mod p).
Using Lemma 8.1.6, show that p/q = [ar , . . . , a0 ].
Exercise 8.6.2 Suppose the rational number p/q has a symmetric continued
fraction, i.e. p/q = [a0 , a1 , . . . , am ] with (a0 , a1 , . . . , am ) = (am , . . . , a1 , a0 ). Using
Lemma 8.1.6, show that q 2 (1)m (mod p).
Exercise 8.6.3 Let p, q N such that gcd(p, q) = 1, q < p/2 and q 2 (mod p).
Show that the normalised continued fraction expansion of p/q is symmetric.
Exercise 8.6.4 Let b/a = [a0 , a1 , . . . , ar ] where ai N for all i and gcd(a, b) = 1.
Let p/q = [ar , ar1 , . . . , a0 , a0 , . . . , ar ]. Using Lemma 8.1.6 show that p = a2 + b2 .
Chapter 9
Diophantine equations
9.1
General remarks
(9.1)
x2 67y 2 = 1,
y 2 = x3 2.
The behaviour of the solution sets seems to be very erratic and depends very
strongly on small variations of the coecients. For example x3 +y 3 = z 3 and x3 +
y 3 = 4z 3 are known to have no integral solutions with xyz = 0 whereas x3 + y 3 =
13z 3 and x3 + y 3 = 22z 3 have innitely many with xyz = 0 and (x, y, z) = 1 (the
smallest solutions being (x, y, z) = (2, 7, 3), (25469, 17299, 9954) respectively).
A famous problem on diophantine equations was Hilberts tenth problem : Is
there a computer program, using unlimited memory, with which one can decide
whether any equation of the form (9.1) has a solution or not. We use the term
computer program here to avoid having to explain the denition of algorithm.
The answer to this question, given in 1970 by Matijasevich is no. The proof is
based on a combination of logic and number theory and unfortunately falls outside
the scope of these notes. The result of Matijasevich suggests that any diophantine
equation has its own peculiarities. On the one hand it makes the solution of
diophantine equations harder, but on the other hand also more interesting because
of the variety of approaches which are now required. In the following sections we
shall discuss a few classes of diophantine equations.
9.2
Pythagorean triplets
95
and
a2 + b2 = c2 .
Notice that in a Pythagorean triplet a and b cannot be both odd. For then
we would have a2 + b2 1 + 1 2(mod 4) but c2 , being a square, cannot be
2(mod 4).
Theorem 9.2.2 Let a, b, c N and suppose that b is even. Then a, b, c is a
Pythagorean triplet if and only if r, s N : r > s, r s(mod 2), (r, s) =
1, a = r2 s2 , b = 2rs, c = r2 + s2 .
Proof. Suppose we have r, s with the given properties. Clearly a, b, c satisfy
a2 + b2 = c2 . Notice also that (a, c) divides (c a, c + a) = (2s2 , 2r2 ) = 2. But
since r s(mod 2), a and c are odd and so (a, c) = 1. Hence (a, b, c) = 1.
Suppose now that a, b, c is a pythagorean triplet. Write b2 = (c a)(c + a). Since
a, c are both odd this implies (b/2)2 = ((a + c)/2)((c a)/2). From (a, b, c) = 1
and a2 + b2 = c2 it follows that (a, c) = 1. Hence also ((c + a)/2, (c a)/2) = 1.
Since the product of these numbers equals (b/2)2 each of them is a square, say
(c + a)/2 = r2 and (c a)/2 = s2 . Hence c = r2 + s2 , a = r2 s2 . Moreover,
(r, s) = 1 and r2 (c + a)/2 s2 + a s2 + 1(mod 2) r2 s2 (mod 2) r
s(mod 2).
2
When we rewrite the equation a2 + b2 = c2 as (a/c)2 + (b/c)2 = 1 we see that
nding Pythagorean triplets is equivalent to nding rational numbers p, q such
that p2 + q 2 = 1, in other words, nding rational points on the unit circle.
Geometrically, the solution to this problem runs as follows. For any point (p, q)
Q2 we draw the line between (p, q) and (1, 0) which is given by Y = t(1 X),
where t = q/(1 p). Conversely, any line through (1, 0) is given by Y = t(1 X).
2 1
The second point of intersection with the unit circle is given by tt2 +1
, t22t+1 . Thus
we can conclude: there exists a bijection between the sets
{t Q} and {x, y Q| x2 + y 2 = 1, (x, y) = (1, 0)}
given by
y
t=
,
1x
(
(x, y) =
t2 1 2t
,
t2 + 1 t2 + 1
)
.
1 2rs r2 s2
.
2M M
96
411340519227716149383203
21666555693714761309610
and hypothenusa
224403517704336969924557513090674863160948472041
8912332268928859588025535178967163570016480830
(D.Zagier)
9.3
Fermats equation
After reading about pythagorean triples it seems natural to ask the following
question. Let n N and n > 2. Does the equation
xn + y n = z n
(9.2)
97
2
2
+ = r < y0 < z0 , contradicting the minimality of z0 . Hence there can
be no solutions.
2
The principle to construct a smaller solution out of a given (hypothetical) solution
is known as Fermats descending induction or descent . This principle, in disguised
form with cohomology groups and all, is still often used for many diophantine
equations.
The case n = 3 was settled by Euler (1753), Dirichlet dealt with the case n = 5
in 1820 and Lame proved Fermats conjecture for n = 7 in 1839. Notice that
the case n = 6 follows from n = 3 because x6 + y 6 = z 6 can be rewritten as
(x2 )3 + (y 2 )3 = (z 2 )3 . In general, since any number larger than 2 is divible either
by 4 or by an odd prime, it suces to prove Fermats conjecture for n = 4, which
we have already done, and for n prime. The methods of solution all follow the
same pattern. Let p be an odd prime and put = e2i/p . Then xp + y p = z p can
be rewritten as
(x + y)(x + y) (x + p1 y) = z p .
The left hand side of the equation has been factored into linear factors at the
price of introducing numbers from Z[]. The right hand side of the equation is a
p-th power and the principle of the proof is now to show that the linear factors
on the left are essentially p-th powers in Z[]. To reach such a conclusion we
would need the property that factorisation into irreducible elements is unique in
Z[]. Assuming this one would be able to conclude a proof of Fermats conjecture,
although it is still not easy. Unfortunately there is one more complicating factor,
prime factorisation in Z[] need not be unique. Finding a way around this problem
has been one of the major stimuli to the development of algebraic number theory.
In 1847 E.Kummer proved the following remarkable theorem.
F.Beukers, Elementary Number Theory
98
It is not hard to see that Bn = 0 when n is odd and larger than 1. A small list
of values,
B2 = 1/6
B4 = 1/30
B6 = 1/42
B8 = 1/30
B10 = 5/66
B12 = 691/2730
B14 = 7/6
B16 = 3617/510
B18 = 43867/798
B20 = 174611/330
As an amusing aside we mention that the numerator of Bk with k p 3, k
even, is divisible by p if and only if 1k + 2k + + (p 1)k is divisible by p2 .
Using the computer and further renements of Kummers theorem one had been
able to verify Fermats conjecture for 2 < n < 4 106 (Buhler, Crandall, Sompolski) around 1990. For more details about the history and proof of Kummers
theory we refer to the books of P.Ribenboim (13 Lectures on Fermats last theorem, Springer Verlag 1979) and H.M.Edwards (Fermats last theorem, Springer
Verlag 1977). Of course these books were pre-Wiles. For an introduction for a
general audience to the techniques entering Wiless proof I highly recommend Simon Singhs book Fermats Enigma: The epic quest to solve the worlds greatest
matehmatical problem (1998). It reads like a novel.
As a generalisation of Fermats conjecture Euler conjectured that for any k
N there are no positive integers x1 , x2 , . . . , xk such that xk1 + + xkk1 = xkk .
However, this was disproved by a counterexample of Lander and Parkin (1967)
reading 1445 = 275 + 845 + 1105 + 1335 . Only in 2004 a second example was
discovered by J.Frye:
555 + 31835 + 289695 + 852825 = 853595 .
In 1988 N.Elkies found spectacular counterexamples in the case k = 4, the smallest of which reads 958004 + 2175194 + 4145604 = 4224814 . He also showed that
there exist innitely many of such examples with k = 4.
9.4
Mordells equation
y 2 = x3 k
(9.3)
99
=
=
=
=
=
=
=
=
(2)3 + 17
(1)3 + 17
23 + 17
43 + 17
83 + 17
433 + 17
523 + 17
52343 + 17
It is a highly non-trivial task to show that this the complete solution set of
y 2 = x3 + 17. Two examples which are easier to deal with are given in the
following theorem.
Theorem 9.4.2 The equation y 2 = x3 + 7 has no solutions in x, y Z. The
only integral solutions to the equation y 2 = x3 2 are (x, y) = (3, 5) (Fermat).
Proof. First we deal with y 2 = x3 + 7. Note that x is odd, because x even would
imply that y 2 7(mod 8), which is impossible. Now notice that
y 2 + 1 = x3 + 8 = (x + 2)(x2 2x + 4)
Notice also that for any x, x2 2x+4 = (x1)2 +3 3(mod 4). Hence x2 2x+4
always contains a prime divisor p which is 3(mod 4). So we get y 2 +1 0(mod p)
which is impossible because of p 3(mod 4).
(y + 2)(y 2) = x3
F.Beukers, Elementary Number Theory
100
3
we nd that there
+ 2 = (a + b 2) . Computing
exist3 a, b 2 Z such2 that 2y
thecube, y + 2 = a 6ab + b(3a 2b ) 2. Comparison of the coecients
of 2 on both sides yields 1 = b(3a2 2b2 ). Hence b = 1 and 3a2 2b2 = 1.
So we nd a = 1 and b = 1. Hence x = a2 +2b2 = 3. The values of y follow. 2
An interesting dierence between the equations y 2 = x3 +7 and y 2 = x3 2 is that
the second equation has innitely many rational solutions. This can be seen by
the so-called chord and tangent method. In the point (3, 5) of the algebraic curve
y 2 = x3 2 we draw the tangent to the curve. It is given by y2 = (27/10)(x3).
Now intersect this line with the curve y 2 = x3 2. Elimination of y yields
x3
729 2 837
1161
x +
x
=0
100
50
100
Because of our tangent construction we already know that this equation has a
double root in x = 3. So the third root must also be a rational number. And
indeed we nd
129
(x 3)2 (x
)=0
100
. So the x coordinate of the third intersection point of the tangent with the curve
equals 129/100. The corresponding y coordinate is 383/1000. Indeed we check
that (x, y) = (129/100, 383/1000) is a rational solution of y 2 = x3 2. Repetition
of this procedure provides us with an innite set of rational solutions. In fact
it turns out that the rational points on y 2 = x3 2 together with the point at
innity have a group structure known as the Mordell-Weil group. This is the
beginning of a fascinating subject of rational points on elliptic curves. Excellent
introductions can be found in Silverman and Tate: Rational points on elliptic
curves.
By checking results for a large number of k M.Hall made the following conjecture
Conjecture 9.4.3 (Hall) There exists a constant C > 0 such that |x3 y 2 | >
Cx1/2 for any x, y N with x3 y 2 = 0.
It is also known that there exist innitely many positive integers x, y such that
1/2
0 < |x3 y 2 | < x (Danilov, 1982) so in this sense Halls conjecture is the
sharpest possible.
9.5
The abc-conjecture
In 1986 Masser and Oesterle formulated a striking conjecture, the truth of which
has far reaching consequences for diophantine equations. For any a Z we let
N (a) (the conductor or radical of a) denote the product of all distinct primes of
a.
F.Beukers, Elementary Number Theory
101
Conjecture 9.5.1 (abc conjecture) Let > 0. Then there exists c() > 0
such that for any triple of non-zero numbers a, b, c Z satisfying a + b + c = 0
and gcd(a, b, c) = 1 we have
max(|a|, |b|, |c|) < c()N (abc)1+ .
To get a feeling for what this conjecture says it is best to consider a number of
consequences.
Consequence 1. Let p, q, r be xed numbers larger than 1 and (p, q, r) = 1.
Then
px + q y = r z
has only nitely many solutions x, y, z Z0 . Application of the conjecture
shows that
rz < c()N (px q y rz )1+ c()N (pqr)1+ .
Hence rz is a bounded number and so are px , q y . In particular x, y, z are bounded.
By other methods it is indeed possible to show that px + q y = rz has nitely
many solutions.
Consequence 2. Fermats conjecture is true for suciently large n. Apply the
abc conjecture to xn + y n = z n with x, y, z N to obtain
z n < c()N (xn y n z n )1+ c()N (xyz)1+ c()z 3(1+) .
Hence, assuming z 2,
2n3(1+) z n3(1+) c()
and this implies n log c()/ log 2 + 3(1 + ).
Consequence 3 Let p, q, r Z2 . Suppose
xp + y q = z r
has innitely many solutions x, y, z N with gcd(x, y, z) = 1. Then
1 1 1
+ + 1.
p q r
Application of the abc conjecture yields
z r c()N (xp y q z r )1+
c()(xyz)1+
c()(z r/p z r/q z)1+ .
Taking z this implies r (1 + r/p + r/q)(1 + ) for any > 0. Hence
r 1 + r/p + r/q and our assertion follows.
Considering the potential consequences of Conjecture 9.5.1 it is likely to be very
dicult to prove. In fact, any weaker version with 1 + replaced by another
number would already be spectacular! The best that can be done by present
day methods (1994) is max(|a|, |b|, |c|) < exp(N (abc)15 ) where is some (large)
constant.
F.Beukers, Elementary Number Theory
102
9.6
The equation xp + y q = z r
gcd(x, y, z) = 1,
xyz = 0
where p, q, r are given integers > 1. From the abc-conjecture we expect this
equation to have nitely many solutions when 1/p + 1/q + 1/r < 1. It was a very
pleasant surprise when Darmon and Granville actually proved this statement in
1993. It turns out to be a consequence of Mordells conjecture, now known as
Faltingss theorem (1983), which we will describe in the next section. Until now
(1997) the only known solutions to this type of equation are
1k + 23 = 32 (k > 5)
132 + 73 = 29
27 + 173 = 712
25 + 72 = 34
35 + 114 = 1222
177 + 762713 = 210639282
14143 + 22134592 = 657
338 + 15490342 = 156133
438 + 962223 = 300429072
92623 + 153122832 = 1137 .
Notice that in each case there occurs an exponent 2. This leads us to the following
unsolved question, which can be seen as a generalisation of Fermats conjecture.
Question 9.6.1 Suppose p, q, r are integers 3. Do there exist solutions to
xp + y q = z r
gcd(x, y, z) = 1,
xyz = 0 ?
When 1/p + 1/q + 1/r = 1 we can show that the set {p, q, r} equals one of the
sets {3, 3, 3}, {2, 4, 4} or {2, 3, 6}. The case p = q = r = 3 is known to have no
solution since Euler, The case p = q = 4, r = 2 was proved in these notes. In the
exercises we show that x4 + y 2 = z 4 has no non-trivial solutions. As for the case
{2, 3, 6} we only have the solutions 23 + (1)6 = (3)2 , but this is not easy to
prove.
When 1/p + 1/q + 1/r > 1 we can show that the set {p, q, r} equals one of the
sets {2, 2, k} (k 2), {2, 3, 3}, {2, 3, 4} or {2, 3, 5}. The case p = q = r = 2
corresponds of course to pythagorean triplets. We might wonder if the other
F.Beukers, Elementary Number Theory
103
cases allow parametric solutions as well. In 1993 Don Zagier, amused by this
question, showed that the following parametrisation yield all integral solutions in
the cases {2, 3, 3} and {2, 3, 4}.
The equation x3 + y 3 = z 2 .
x = s4 + 6s2 t2 3t4
y = s4 + 6s2 t2 + 3t4
z = 6st(s4 + 3t4 )
x = (1/4)(s4 + 6s2 t2 3t4 )
y = (1/4)(s4 + 6s2 t2 + 3t4 )
z = (3/4)st(s4 + 3t4 )
x = s4 + 8st3
y = 4s3 t + 4t4
z = s6 20s3 t3 8t6
The equation x4 + y 3 = z 2 .
x = (s2 3t2 )(s4 + 18s2 t2 + 9t4 )
y = (s4 + 2s2 t2 + 9t4 )(s4 30s2 t2 + 9t4 )
z = 4st(s2 + 3t2 )(s4 6s2 t2 + 81t4 )(3s4 2s2 t2 + 3t4 )
x = 6st(s4 + 12t4 )
y = s8 168s4 t4 + 144t8
z = (s4 12t4 )(s8 + 408s4 t4 + 144t8 )
x = 6st(3s4 + 4t4 )
y = 9s8 168s4 t4 + 16t8
z = (3s4 4t4 )(9s8 + 408s4 t4 + 16t8 )
x = s6 + 40s3 t3 32t6
F.Beukers, Elementary Number Theory
104
The equation x4 + y 2 = z 3 .
x = (s2 + 3t2 )(s4 18s2 t2 + 9t4 )
y = 4st(s2 3t2 )(s4 + 6s2 t2 + 81t4 )(3s4 + 2s2 t2 + 3t4 )
z = (s4 2s2 t2 + 9t4 )(s4 + 30s2 t2 + 9t4 )
x = 6st(s4 12t4 )
y = (s4 + 12t4 )(s8 408s4 t4 + 144t8 )
z = s8 + 168s4 t4 + 144t8
x = 6st(3s4 4t4 )
y = (3s4 + 4t4 )(9s8 408s4 t4 + 16t8 )
z = 9s8 + 168s4 t4 + 16t8
x = (3/2)st(s4 3t4 )
y = (1/8)(s4 + 3t4 )(s8 102s4 t4 + 9t8 )
z = (1/4)(s8 + 42s4 t4 + 9t8 )
F.Beukers, Elementary Number Theory
105
We shall deal with the case {2, 2, k} in the exercises. The only equation that
remains is x5 + y 3 = z 2 . In 1995 it was proved by F.Beukers that again a nite
numbers of parametrised solutions suce to give the complete solution set. In
2001 Johnny Edwards managed to produce the full list of these parametrisations.
Here is the x-coordinate of one such parametrisation,
x = 185s12 144s11 t 2046s10 t2 + 9680s9 t3 13365s8 t4 + 15840s7 t5
20724s6 t6 + 9504s5 t7 + 8415s4 t8 16720s3 t9 + 6930s2 t10 1776st11 + 701t12
9.7
Mordells conjecture
After seeing a good many particular examples one might wonder whether anything is known about diophantine equations in general. For a long time only one
result in such a direction was known.
Theorem 9.7.1 (C.L.Siegel 1929) Let P (X, Y ) Z[X, Y ] be a polynomial,
irreducible in C[X, Y ]. Suppose that the genus of the projective curve given by
P = 0 is at least 1. Then P (x, y) = 0 has at most nitely many solutions in
x, y Z.
The proof is quite dicult and involves ideas from diophantine approximation
and arithmetic algebraic geometry. Standard examples of curves of genus 2 are
the hyper-elliptic curve y 2 = q(x), where q(x) is a polynomial of degree at least
5 and distinct zeros and the Fermat curve xn + y n = 1 with n > 3.
Already in 1922 L.J.Mordell conjectured that under the conditions of Siegels
theorem P (x, y) = 0 has at most nitely many solutions in x, y Q. This
conjecture withstood attempts to solve it for a long time until in 1983 G.Faltings
managed to provide a proof of it. Unfortunately this proof can only be understood
by experts in arithmetic algebraic geometry. In 1988 P.Vojta found a brilliant
new proof which, unfortunately, had the same drawback as Faltings proof in
that it was accessable only to a very small group of experts. In 1990 E.Bombieri
considerably simplied Vojtas proof, thus making it understandable for a large
audience of number theorists and algebraic geometers.
About polynomial diophantine equations in more than two variables almost nothing is known, although there exist a good many fascinating conjectures about
them.
9.8
Exercises
106
Exercise 9.8.11 Suppose the abc-conjecture holds. Prove that there exist at most
nitely many triples ar , bs , ct such that ar + bs = ct , gcd(a, b) = 1 and 1/r + 1/s +
1/t < 1. (Hint: prove and make use of the following statement: 1/r + 1/s + 1/t <
1 1/r + 1/s + 1/t 1 1/42.)
Exercise 9.8.12 Find a, b, c Z such that 7 |abc and a7 + b7 c7 (mod 73 ).
Exercise 9.8.13 Show, assuming the abc-conjecture, the modied Hall conjecture which reads as follows. For every a < 1/2 there exists c(a) > 0 such that for
any positive integers x, y with x3 = y 2 we have |x3 y 2 | > c(a)xa .
Chapter 10
Prime numbers
10.1
Introductory remarks
In previous chapters we have seen that prime numbers play a crucial role in
number theory. We repeat here that by a prime number we mean an integer
which cannot be written as a product of smaller numbers. In this chapter we
occupy ourselves with the distribution of primes in N.
Theorem 10.1.1 (Euclid) There exist innitely many primes.
Proof. We have already seen Euclids proof in Theorem 1.4.5. Here we present
another proof due to Euler. Although slightly more complicated than Euclids
proof it uses an idea which will return repeatedly.
We shall show that
)
(
1
1
p
pN
tends to zero as N . Here, the product is taken over all primes p N .
Notice that by the unique factorisation theorem in Z,
)1 (
)
N
(
1
1
1
1
1
=
1 + + 2 + >
p
p p
n
n=1
pN
pN
Since the latter sum tends to innity as N we see that our product tends
to zero as N . Hence there are innitely many primes.
2
As a consequence of Eulers method we nd the following corollary.
1
Corollary 10.1.2 The sum
, taken over all primes, diverges.
p
1
Proof. Notice that for any x (0, 12 ) we have x > 12 log 1x
. Hence
1
1
1
> log
p
2
1 p1
pN
pN
107
108
and since the product tends to as N we see that our sum diverges.
A more precise analysis, as performed by Mertens, reveals that there exists a real
number A such that for all X > 2 we have
1
= log log X + A + O((log X)1 )
p
p<X
where the summation is over all primes p < X
Definition 10.1.3
(x) = #{p x| p prime}.
The local distribution of prime numbers seems to be completely erratic, and not
much is known about it. Remarkably enough one can say quite a few things about
the global distribution of primes as reected by (x). In the following table we
have counted s, the number of primes in the interval [x 75000, x + 75000] for
several values of x,
x
s
150000/ log x
8
10
8154
8143
109
7242
7238
10
10
6511
6514
11
10
5974
5922
1012
5433
5428
13
10
5065
5011
1014
4643
4653
15
10
4251
4342
The last column of this table suggests that the density of the primes near x is
about equal to 1/ log x. This led Gauss to conjecture,
x
dt
(x) li(x) :=
.
2 log t
The sign must be interpreted as asymptotic equality. More precisely, f (x)
g(x) means that f (x)/g(x) 1 as x . Since li(x) x/ log x we might also
conjecture,
x
(x)
.
log x
The rst result in this direction was obtained by Chebyshev who proved around
1852 that
x
x
< (x) < 1.11
0.92
log x
log x
for suciently large x. In 1860 Riemann, in a now historical paper, introduced
the complex function
1
(s) =
Res > 1
ns
n1
F.Beukers, Elementary Number Theory
109
in the study of prime numbers. For Res > 1 it is easy to see that (s) is analytic
and Riemann showed that it can be continued analytically to C with the exception
of s = 1, where it has a rst order pole with residue 1. The relation of (s) with
prime numbers is made apparent by the Euler factorisation
(s) =
(
p
1
1 s
p
)1
where the product is over all primes p. It turns out that for the distribution
of the primes the zeros of (s) in the critical strip 0 Res 1 are extremely
important. If there would have been no zeros in this strip one could have proved
some marvelous theorems on prime numbers. Unfortunately there are zeros in the
strip but, and this is fortunate again, they all seem to lie on the line Res = 1/2.
This was posed by Riemann as a question and until now no one has been able to
conrm it. This question, known as the Riemann hypothesis , is one of the classical
problems in mathematics. It follows very easily from Riemanns work that the
zeros lie symmetrical around the X-axis. So it suces to look at zeros in the
upper half plane. We order them in the order of increasing imaginary part. Then
it is known that the rst 1500 000 000 zeros are all simple and lie on Res = 1/2
(Brent, v.d.Lune, te Riele, Winter). It was proved by Levinson (1974) that at
least a third of the zeros in the critical strip is on the line Res = 1/2. It should
be noted that the zeros outside the critical strip are given by s = 2, 4, 6, . . .
and they are called the trivial zeros.
Continuing Riemanns work Hadamard and De la Vallee-Poussin, independently
of each other, proved the following theorem in 1896.
Theorem 10.1.4 (Prime number theorem)
(x)
x
.
log x
In 1949 Selberg and Erdos, more or less independently, gave an elementary proof
of the prime number theorem. By elementary we mean that no use is made of
complex function theory. It does not imply that the proof is simple!
Later it turned out that Gauss function li(x) is a better approximation of (x)
than x/ log x. Assuming the Riemann hypothesis we have
(x) = li(x) + O(x1/2 log x).
However, one is a long way o at proving such results. The best known estimate
are of the form
1
(x) = li(x) + O(x exp(
log x).
15
F.Beukers, Elementary Number Theory
110
Here we give a table which compares values of (x) and li(x) for several x.
x
(x)
li(x) (x)
102
25
5
3
10
168
10
4
10
1229
17
105
9592
38
6
10
78498
130
107
664579
339
8
10
5761455
754
9
10
50847534
1701
1010
455052511
3104
11
10
4118054813
11588
1012
37607912018
38263
13
10
346065536839
108971
14
10
3204941750802
314890
1015 29844570422669
1052619
1016 279238341033925
3214632
As a peculiarity note that the values of (x) = li(x) (x) in our table are
all positive. Since x becomes quite large in our table one might suspect that
(x) is always positive. That one should be careful in stating such beliefs was
shown by Littlewood who proved in 1914 that (x) changes sign innitely often.
Around 1933 Skewes showed that, assuming the Riemann hypothesis, the rst
1034
sign change should be somewhere below 1010 . Numbers of this size were soon
called Skewes numbers. We now know, without having to assume the Riemann
hypothesis, that the rst change of (x) is somewhere below 6.7 10370 .
Finally a few words about the local distribution of primes. Let us denote by
p1 , p 2 , . . . , pn , . . .
the sequence of prime numbers in increasing order. First of all, pn+1 pn may
become arbitrarily large, i.e. there exist arbitrarily long gaps in the sequence
of prime numbers. To nd a gap of length at least N 1, say, we just have
to write down N ! + 2, N ! + 3, . . . , N ! + N and notice that these numbers are
divisible by 2, 3, . . . , N . By means of elementary methods Chebyshev proved
in 1852 that pn+1 < 2pn , thereby conrming Bertrands postulate . It is now
1
384
known, using deep analytic methods that pn+1 pn = O(pn ) with = 11
12
(Iwaniec, Pintz, Mozzochi). If Riemanns hypothesis is true then one can prove
111
10.2
Elementary methods
In this section we shall prove two theorems by elementary methods which are
similar in spirit to the methods used by Chebyshev.
Theorem 10.2.1 Let n N and n > 10. Then
1 n
n
< (n) < 3
.
3 log n
log n
Theorem 10.2.2 (Bertrands postulate) For any n N there exists a prime
number p such that n < p 2n.
For the proof of these theorems we require a few lemmas.
Lemma 10.2.3 Let n N. Then
a) n 5 :
b) n 4 :
)
2n
< 4n1
n
)
2n
4n
> .
n
n
)
(
)
2n
2n(2n 1) 2(n 1)
=
.
n
nn
n1
(10.1)
To prove statement (a) notice that it is true for n = 5 and apply induction on n
using the second inequality in (10.1). To prove (b) note that it is true for n = 4
and apply induction on n using the rst inequality in (10.1).
2
F.Beukers, Elementary Number Theory
112
Lemma
( ) 10.2.4 Let p be prime and n N. Let k be the number of prime factors
p in 2n
. Then
n
(a) pk 2n.
(b) If n < p 2n then k = 1.
(c) If 2n/3 < p n and n > 2 then k = 0.
Proof. For any m N we know that the number of factors p in m! is equal to
[
] [ ]
]
[
m
m
m
+ 2 + =
.
p
p
pr
r=1
Hence
k=
]
([
2n
pr
r=1
n
2 r
p
])
.
(10.2)
Notice that 0 [2x] 2[x] 1 for any x R. Notice also that the terms in
(10.2) vanish when r > log 2n/ log p. Hence
k
]
log 2n
log 2n
1=
log p
log p
p < 4n .
pn
pprime
( )
Proof. Let m N and m 5. Observe that according to Lemma 10.2.4(b) 2m
m
is divisible by all primes p with m < p 2m. Hence, using Lemma 10.2.3(a),
p < 4m1 .
m<p2m
(10.3)
113
We shall prove our statement by induction on n. First of all our lemma can be
veried byhand forall n < 10. Now suppose n 10. If n is even we have
obviously pn p = pn1 p < 4n1 < 4n and we are done. If n is odd we write
p=
p
p.
p n+1
2
pn
n+1
<pn+1
2
The rst product on the right can be estimated using our induction hypothesis
p < 4n .
n<pn
(1/2)((n)( n))
< 4n
and hence
n
(n) ( n) < 2 log 4
.
log n
n
n0.5
+
.
log n
2
When n > 200 this can be bounded by 3n/ log n as desired. For n 200 we have
to verify this upper bound case by case.
Let m 4. By combination of Lemma 10.2.3(b) and Lemma 10.2.4(a) the lower
bound is derived as follows
( )
4m
2m
<
(2m) = (2m)(2m) .
m
m
p2m
Hence
log(4m /m)
2m
> log 2
1.
log 2m
log 2m
Suppose n 8. When n = 2m is even we deduce,
n
(n) log 2
1
log n
(2m)
2m + 2
n
1 > log 2
1.
log(2m + 2)
log n
1 n
3 log n
as desired. 2
114
2n
p
p
<
(2n).
n
n<p2n
p2n/3
(10.4)
p 2n
The second product on the right can be estimated using Lemma 10.2.5 and yields
the upper
bound 42n/3 . The third product on the right can be estimated by
2n
(2n) . Elementary estimates show that this can be bounded above by 4n/3 /n
as soon as n > 512. Hence when n > 512 we obtain from (10.4),
( ) ( ) n
2n
4
<
p
.
(10.5)
n
n
n<p2n
( )
> 4n /n. Together with
From Lemma 10.2.3(b) we have thelower bound 2n
n
(10.5) this implies that the product n<p2n p is non-empty when n > 512. For
n 512 observe that
2, 3, 5, 7, 13, 23, 43, 83, 113, 223, 443, 881
is a sequence of prime numbers of which each term is smaller than twice its
predecessor. Hence the theorem is also true for n 512.
2
10.3
Exercises
(1 ps )1
ns
b)
s 1
(1 p )
<
ns
(1 ps )1 =
ns
s > 1.
n=1
p prime
(1 ps )1
ns
pX
p prime
s > 1, X 1
n=1
pX
p prime
c)
s R>0 , X 1
nX
pX
p prime
nX
s R>0 , X 1
10.3. EXERCISES
115
b)
1
> log X
n
nX
X 1.
Now choose s = 1 in part a), take logs on both sides and show that
c)
1
1
> log log X .
p
2
pX
p prime
k N, x 2.
x
(log x)k+1
)
n N.
1
,
p
log
p
prime
log p
.
p
p prime
116
Exercise 10.3.9 (*) (H.W.Lenstra jr.) Prove that for innitely many n N we
have (n)|n. (Examples: (30) = 10|30, (1008) = 168|1008).
1
Exercise 10.3.10 Consider for any n the integral In = t=0 tn (1 t)n dt.
a)Prove that In is a rational number whose denominator divides lcm[n, . . . , 2n+1].
(Hint: integrate term by term).
b)Prove that |In | < (1/4)n .
c)Prove that lcm[1, . . . , m] 2m1 for all m N.
Exercise 10.3.11 Use the ideas of the
previous exercise.
a) Prove that |t(1 t)(1 2t)| < 1/6 3, t [0, 1].
b) Prove that lcm(1, 2, . . . , 6n + 1) 108n n N.
1
c) Prove that lcm(1, 2, . . . , m) 108
((108)1/6 )m , m N.
Chapter 11
Irrationality and transcendence
11.1
Irrationality
118
1
.
k!
k=0
The number
1
1
1
1! 2!
k!
is a positive rational number with a denominator dividing d(k!). Hence, since
is not zero,
1
.
k!d
On the other hand,
:= e 1
1
1
+
+
(k + 1)! (k + 2)!
(
)
1
1
1
+
+
=
k! k + 1 (k + 1)(k + 2)
(
)
1
1
1
<
+
+
k! k + 1 (k + 1)2
11
=
k! k
tm sin tdt
0
sin tdt = 2
t sin tdt = 1.
0
t sin tdt = 1
2
0
0
from which our assertion follows.
F.Beukers, Elementary Number Theory
11.1. IRRATIONALITY
119
1 d m m
( ) t (1t)m
m! dt
In =
Hence
2n+1
0 < |In | <
.
(2n)!
On the other hand we can compute In term by term. Lemma 11.1.5 then implies
that In = An (1/ 2 ), where An (x) Z[x] and deg An n.
Suppose that 2 = a/b for some a, b N. Because An has degree n the number
In = An (1/ 2 ) = An (b/a) is a fraction whose denominator divides an . Moreover,
In = 0. Hence
1
|In | n .
a
Together with the upper bound for |In | this implies
1
2n+1
<
a2n
(2n)!
which becomes impossible when n . Hence 2 Q. This immediately
implies Q.
2
Around 1740 Euler proved e to be irrational and the rst proof of the irrationality
of was given by Lambert in 1761. This proof was based on the continued fraction
expansion of arctg(x). The proof we gave can be considered as a variation of a
proof given by I.Niven. On the other hand there are many naturally occurring
numbers for which no irrationality results are
known. For example, it is not
known whether Eulers constant = limn ( nk=1 (1/k) log n) or e + or e
is irrational. Motivated by the standard series for e P.Erdos asked the following
question. Is
1
k! + 1
k=1
irrational? Surprisingly this seems to be dicult to answer.
F.Beukers, Elementary Number Theory
120
11.2
Transcendence
Definition 11.2.1 A number C is called algebraic if it is the zero of a nontrivial polynomial with coecients in Q. A number is called transcendental if it
is not algebraic.
Obviously, proving transcendence of a number is much harder than proving irrationality. It is therefore no surprise that in the beginning of the 19th century no
examples of transcendental numbers were known. In 1844 Liouville proved the
following theorem.
Theorem 11.2.2 (Liouville 1844) Let be an algebraic number whose minimal polynomial has degree n. Then there exists a positive constant c such that
for any p, q Z and q > 0,
p
c .
q qn
Proof. Let P (x) Z[x] be the minimal polynomial of . Since P has no rational
roots we have P (p/q) = 0 and, moreover, |P (p/q)| 1/q n . Write P (x) =
(x )Q(x) and let M = max|x|1 |Q(x)|. Suppose | p/q| 1. Then,
trivially, |P (p/q)| M |p/q|. Combined with our lower bound for |P (p/q)| this
yields | p/q| 1/(M q n ). This proves our theorem with c = min(1, 1/M ). 2
Corollary 11.2.3 Let R. Suppose that there exists a sequence of rational
numbers {pn /qn }
n=1 , with qn > 0 for all n, and a sequence of numbers n such
that
pn
c
0 < < n
lim n =
n
qn
q
n
1
=
2k!
k=0
is transcendental.
Proof. We apply Corollary 11.2.3. Let qn = 2n! and pn = 2n! nk=0 (1/2k! ). Then
1
p
1 1
2
2
n
=
= (n+1)! = n+1 .
< (n+1)!
k!
j
qn
2 2
2
2
qn
j=0
k=n+1
F.Beukers, Elementary Number Theory
11.2. TRANSCENDENCE
121
Through the pioneering work of Cantor on set theory around 1874 it also became
clear that almost all real numbers are transcendental. This follows from the
following two theorems.
Theorem 11.2.5 The set of algebraic numbers is countable.
Proof. It suces to show that the set Z[X] is countable. To any polynomial
P (X) = pn X n + pn1 X n1 + + p1 X + p0 Z[X] with pn = 0 we assign the
number (P ) = n + |pn | + |pn1 | + + |p0 | N. Clearly for any N N the
number of solutions to (P ) = N is nite, because both the degree and the size
of the coecients are bounded by N . Hence Z[X] is countable.
2
Theorem 11.2.6 (Cantor) The set of real numbers is uncountable.
Proof. We will show that the set of real numbers in the interval [0, 1) is uncountable. Suppose that this set is countable. Choose an enumeration and
denote the decimal expansion of the n-th real number by 0.an1 an2 an3 , where
anm {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} for all n, m. Now consider the real number whose
decimal expansion reads 0.b1 b2 b3 where the bi are chosen such that bi = aii for
every i. This choice implies that does not occur in our enumeration. Hence
[0, 1) is uncountable.
2
The principle of the proof of Theorem 11.2.6 is known as Cantors diagonal procedure and it occurs in many places in mathematics.
Almost all real numbers being transcendental, it seems ironic that until the end
of the 19-th century not a single naturally occurring number was known to be
transcendental. Only in 1873 Hermite showed that e is transcendental and in
1882 Lindemann proved to be transcendental. In his famous lecture of 1900
D.Hilbert asked whether numbers of the form ab with a, b algebraic, a = 0, 1
and b Q, are transcendental. Specic examples are 2 2 and i2i = e . This
problem was considered to be very dicult by Hilbert, but already in the 1930s
A.O.Gelfond and Th.Schneider indepently developed techniques to solve this
problem. So now we know,
Theorem 11.2.7 (Gelfond, Schneider ,1934) Let a, b be algebraic and suppose that a = 0, 1 and b Q. Then ab is transcendental.
Corollary 11.2.8 Let , be two positive real algebraic numbers such that = 1
and log / log Q. Then log / log is transcendental.
Proof. Let b = log / log and suppose b is algebraic. Then, according to
Theorem 9.2.7 the number = b is transcental which is impossible since is
algebraic.
2
Nowadays the Gelfond-Schneider theory has grown into a eld of its own in which
large classes of numbers, ususally related to algebraic geometry, are known to be
transcendental.
F.Beukers, Elementary Number Theory
122
11.3
Irrationality of (3)
s
Let (s) =
n=1 n . We shall be interested in the numbers (m) with m Z2 .
Euler showed that
B2n 2n
(2n) = (1)n1 22n1
(2n)!
where B2n is the 2n-th Bernoulli number. Hence (2n) is transcendental because
2n is transcendental. Strangely enough next to nothing is known about the
numbers (2n + 1) for n 1. It was therefore a complete surprise when in
1978 the french mathematician R.Apery announced a proof of (3) Q. The
rst reaction of his fellow mathematicians was incredulity, since the presentation
of the proof was a mixture of remarkable formulae and downright impossible
statements. Later this proof was patched up by H.Cohen and D.Zagier and
Apery turned out to be correct on all the crucial parts. The simple proof we
present here was found by F.Beukers, but the shape of the integrals is motivated
by Aperys formulae.
Lemma 11.3.1 Let r, s Z0 . If r > s then
Z
log xy r s
x y dxdy
.
1 xy
[1, 2, . . . , r]3
If r = s then
(
)
log xy r r
1
1
x y dxdy = 2 (3) 3 3 .
1 xy
1
r
xr+ y s+
dxdy.
1 xy
Develop (1 xy)1 in a geometrical series and carry out the integration term by
term. We nd
1
.
(k + r + + 1)(k + s + + 1)
k=0
When r > s this implies
(
)
xr+ y s+
1
1
1
dxdy =
1 xy
rs k+s++1 k+r++1
k=0
(
)
1
1
1
+ +
=
rs s+1+
r+
123
)
(
log xy r r
1
2
1
x y dxdy =
= 2 (3) 3 3
3
1 xy
(k
+
r
+
1)
1
r
k=0
2
pn
plog n/ log p
pn
n = n(n)
pn
where the products are taken over the primes p. According to the prime number
theorem we have (n) < (log 3)n/ log n for suciently large n. Hence n(n) < 3n
for n suciently large.
2
Theorem 11.3.3 (R.Ap
ery 1978) The number (3) is irrational.
Proof. Consider the double integral
1 1
log xy
In =
Pn (x)Pn (y)dxdy
1 xy
0
0
( d )n n
where Pn (x) = n!1 dx
x (1 x)n . Notice that P (x) Z[x]. From Lemma 11.3.1
it follows that
An + Bn (3)
In =
,
An , Bn Z.
[1, 2, . . . , n]3
Notice that
log xy
=
1 xy
hence
In =
1
dz
1 (1 xy)z
Pn (x)Pn (y)
dxdydz
1 (1 xy)z
111
where stands for 0 0 0 . After an n-fold partial integration with respect to
x we obtain
124
Pn (y)
dxdydw.
In = (1 x)n (1 w)n
1 (1 xy)w
An n-fold partial integration with respect to y yields
n
x (1 x)n y n (1 y)n wn (1 w)n
In =
dxdydw.
(1 (1 xy)w)n+1
It is an excercise to show that for all 0 x, y, w 1 we have
|In | < ( 2 1)
4n
dxdydw
= 2( 2 1)4n (3).
1 (1 xy)w
1
1
<
|In | < 2( 2 1)4n (3).
n
3
27 q
[1, 2, . . . , n] q
Hence,
11.4
Exercises
Exercise 11.4.1 Prove, using the series expansions for e and e1 , that e is not
algebraic of degree 2.
Exercise 11.4.2 Show that
log 3
log 2
is irrational.
( )n
4
1
Q.
5
3n2
n=0
Chapter 12
Solutions to selected problems
(1.5.3) When m is odd we have the polynomial factorisation
xm + 1 = (x + 1)(xm1 xm2 + x + 1).
Suppose that n is not a power of 2, i.e. n contains an odd divisor m > 1.
Suppose n = m k. Substitute x = 2k in the above identity, then
2n + 1 = 2mk + 1 = (2k + 1)(2k(m1) 2k(m2) + 2k + 1).
So 2k +1 is a divisor of 2n +1. It remains to point out that it is a non-trivial
divisor, i.e. 1 < 2k + 1 < 2n + 1. So 2n + 1 is not prime, a contradiction.
Therefore n cannot contain odd divisors > 1.
(1.5.2) When m is odd we have the polynomial factorisation
xm 1 = (x 1)(xm1 + xm2 + + x + 1).
Suppose that n is not a prime i.e. n = m k for some integers k, m > 1.
Substitute x = 2k in the above identity, then
2n 1 = 2mk 1 = (2k 1)(2k(m1) + 2k(m2) + + 2k + 1).
So 2k 1 is a divisor of 2n 1. It remains to point out that it is a non-trivial
divisor, i.e. 1 < 2k 1 < 2n 1. So 2n 1 is not prime, a contradiction.
Therefore n cannot be composite.
(1.5.6) Suppose that p + 2 is composite for only nitely many primes p. Then there
is a number P0 such that p prime and p > P0 implies p + 2 prime. Choose
a prime p > P0 . Then, consequently, all odd numbers larger than p are
prime. This is clearly impossible since, fore example, all powers of 3 are
composite. We get a contradiction.
125
126
qn1 rn1 + rn
rn1 + rn
kn+1 + kn = kn ( + 1)
kn 2 = kn+2
127
(2.3.1) A perfect number n is characterised by (n) = 2n. In other words,
2n divide on both sides by n to obtain
d|n
d=
d
= 2.
n
d|n
Notice that as d runs over the divisors of n, the number d/n runs over all
inverses of the divisors of n. Hence
1
= 2.
d
d|n
(2.3.3) All convolution products are convolution products of multiplicative functions. Hence the convolution products are also multiplicative. To describe
the products it suces to describe their values in the prime powers. Here
are the results,
1. (Ik Ik )(n) = 0 (n)nk
2. I1 =
3. ( )(pk ) = 2 als k = 1, 1 als k = 2, 0 als k > 2
4. ( 2 )(n) = |(n)|
5. (2 2 )(pk ) = 4k
6. ( )(pk ) = pk 2pk1 + pk2 if k 2, p 2 if k = 1.
(2.3.7) We shall prove something more general. Let f (n) be any arithmetic function
with f (1) = 0. Then there exists an arithmetic function g such that f g =
e. In other words, we must determine numbers g(1), g(2), g(3), . . . such that
f (1)g(1) = 1 and for all n > 1,
f (d)g(n/d) = 0
d|n
f (1)g(n) =
g(d)f (n/d).
d|n,d<n
Note that the latter relation allows us to determine g(2), g(3), g(4), . . . recursively. Notice also that g is uniquely determined.
To complete our exercise, we must show that if f is multiplicative, then
so is g. To that end we construct a multiplicative function h such that
f h(pk ) = 0 for all prime powers pk and f h(1) = 1. By the multiplicative
F.Beukers, Elementary Number Theory
128
k1
h(pl )f (pkl ).
l=0
0 (d)3 =
0 (pl )3 =
(l + 1)3 .
d|pk
l=0
l=0
l 2
2
0 (p )) = ( (l + 1))2 .
(
0 (d)) = (
d|pk
l=0
l=0
The two results are equal because we have the famous identity
13 + 23 + + (k + 1)3 = (1 + 2 + + (k + 1))2
for all positive integers k.
(3.5.1) Suppose that n = ab with 1 < a < b < n. Then the product (n 1)!
contains both factors a and b. Hence ab divides (n 1)!. Suppose n is
composite and suppose it cannot be written as a product of two distinct
numbers a, b < n. Then n must be the square of a prime p, i.e. n = p2 .
We have assumed n > 4, so p > 2. But in that case the product (n 1)!
contains the factors p and 2p. So p2 divides (n 1)!.
(3.5.3) Note that a number is divisible by 11 if and only if the alternating sum of its
digits is divisible by 11. The alternating sum of the digits of a palindromic
number of even length is zero.
(3.5.4) Answers: 3(mod 7), 13(mod 71), 83(mod 183).
(3.5.6) Answers:
a) x 1307(mod 2100)
b) y 675(mod 1540)
c) z 193(mod 420)
F.Beukers, Elementary Number Theory
129
(3.5.8) Instead of a million consecutive numbers we can more generally ask for n
consecutive numbers, where n is any integer. We choose n distinct primes
p1 , p2 , . . . , pn and solve the simultaneous system of congruences
x + 1 0(mod p21 ) x + 2 0(mod p22 )
x + n 0(mod p2n ).
Since the numbers p2i are pairwise relatively prime, the Chinese remainder
theorem shows the existence of a solution x N. Hence x+1, x+2, . . . , x+n
is a sequence of n consecutive numbers all divisible by a square > 1.
(3.5.9) Notice that by the chinese remainder theorem,
a2 a(mod 10k ) a2 a(mod 2k ),
a2 a(mod 5k ).
130
10)
10)
10)
10)
10)
10)
10)
10)
10)
7
7
(1(mod
(0(mod
(1(mod
(0(mod
(1(mod
(0(mod
(1(mod
(0(mod
(1(mod
2), 1(mod
2), 2(mod
2), 3(mod
2), 4(mod
2), 0(mod
2), 1(mod
2), 2(mod
2), 3(mod
2), 4(mod
5))
5))
5))
5))
5))
5))
5))
5))
5))
42 3(mod 13).
2n+1
a(pi
ki 1
(pi 1)
api
Hence
a(n) 1(mod pki i ) for i = 1, 2, . . . , r
By the Chinese remainder theorem this implies a(n) 1(mod n).
(3.5.15) Notice that 2730 = 2 3 5 7 13. By the Chinese remainder theorem
it suces to show that n13 n(mod p) for all n and p = 2, 3, 5, 7, 13. We
repeatedly use Fermat little theorem.
n13 n(mod 13) for all n (Fermats little theorem).
n13 n7 n6 n n6 n7 n
(mod 7).
131
(3.5.16) We must solve: 2p1 1 = pu2 in an odd prime p and an integer u. Note
that u must be odd. factorisation of the left hand side yields (2(p1)/2
1)(2(p1)/2 + 1) = pu2 . The factors on the left are relatively prime (check!).
This implies that there exist positive integers r, s such that either
2(p1)/2 1 = pr2 ,
2(p1)/2 + 1 = s2
or
2(p1)/2 1 = r2 ,
2(p1)/2 + 1 = ps2 .
(p1)/2
) )2
p1
! .
2
(3.5.21) This is slightly tedious. Write (n) = n p|n (1 1/p). We give a lower
p|n
(1 1/p)
1
2
(1 1/p)
p|n, p odd
132
1 2
(1 1/p)
2 3
p|n
1 log(2/3)/ log(2)
n
2
1 0.5
n
2
=
1
2
n10.5 =
1
2
(3.5.28) The orders are 6, 11, 8 respectively. To shortcut the computation, notice
for example that (46) = 22. So the order of 3(mod 46) divides 22. Thus
we need only check whether, 31 , 32 , 311 are 1(mod 46). If not, then 22 is the
order of 3(mod 46). It turns out that 311 1(mod 46).
(3.5.30) Note that 2p 1(mod q). The order of 2(mod q) thus divides p. Since
p is a prime and 21 1(mod q) the order is precisely p. Hence p divides
(q) = q 1. So q 1(mod p). Furthermore, since q is odd, q 1(mod 2).
Hence, because p is odd, we conclude that q 1(mod 2p). So q is of the
form q = 2mp + 1.
(3.5.31) To show part (a) notice that a2 1(mod q). Together with its square
n+1
a2
1(mod q) we note that a has order 2n+1 in (Z/qZ) . Hence 2n+1
divides q 1 which solves part (a).
n
133
computed by computing 2k (mod 121) with 1 k < 110 and gcd(k, 110) =
1.
(3.5.34)
(3.5.35) We use the function (n) from exercise 3.5.14. If we have a primitive root
modulo m then we should have (m) = (m). In other words
lcm(pk11 (p1 1), . . . pkr r (pr 1)) = (pk11 (p1 1), pkr r (pr 1)).
This means that the numbers pki i (pi 1) are all relatively prime. In particular, there can be at most one odd prime factor pi . So m is of the form
m = 2l pk . When k = 0 we have m = 2l and we know that l = 1, 2. When
l = 0 we have m = pk . Suppose that k, l > 0 Then 2l1 and pk1 (p 1) are
relative prime. But this is impossible if l > 1. Hence l = 1 and m = 2pl .
(3.5.29) Case a) We must determine all p such that 10 has order 1,2,3,4,5 or 6 modulo 10. Hence we must determine all p that divide at least one of 101, 102
1, 103 1, 104 1, 105 1, 106 1. This gives us p = 3, 7, 11, 13, 37, 41, 101, 271.
Case b) Using the idea from case a) we get p = 239, 4649.
Case c) p = 73, 137
(3.5.41) From an1 1(mod n) we see that gcd(a, n) = 1. Let k be the order of
a(mod n). Then k|n 1. Suppose that (n 1)/k contains a prime divisor q.
Then a(n1)/q 1(mod n), contradicting our assumptions. Hence (n 1)/k
contaisn no prime divisors, hence (n1)/k = 1 from which we get k = n1.
We also know that k and hence n 1 divide (n). This is only possible if
(n) = n 1, hence n is prime.
F.Beukers, Elementary Number Theory
134
114
127
(
=
2
127
)(
3
127
)(
19
127
. The
19 ( )
13
13
( 2 )( 3 )
(191 )
( 114 )latter equals
13
13 13 = (1) 3 = 3 = 1. So we conclude 127 = 1, our
equation is not solvable.
We now study the solvability of 9x2 + 12x + 15 0(mod 58). Splitting o
squares gives (3x + 2)2 + 11 0(mod 58). So it suces to study solvability
of y 2 11(mod 58). By the Chinese remainder theorem this is equivalent
to the system y 2 1(mod 2), y 2( )11(mod 29). The rst equation is
. Note that is equals
solvable, it remains to determine 11
29
(
1
29
)(
11
29
(
=
29
11
(
=
7
11
(
=
11
7
( )
4
=
= 1.
7
135
(5.7.8) Let p be an odd prime = 5. Note that
( ) ( )
5
p
=
p
5
The latter is 1 if p 1(mod 5) and 1 if p 2(mod 5).
Now let p be an odd prime = 3. Then
( ) ( )( )
( )
1
3
3
(p1)/2
(p1)/2 p
=
= (1)
(1)
.
p
p
p
3
The latter is 1 if p 1(mod 3) and 1 if p 1(mod 3).
Finally,
( )
( )
3
(p1)/2 p
= (1)
.
p
3
we can now read o that the Legendre symbol is 1 if p 1(mod 12) and
1 if p 5(mod 12).
(5.7.9) Let a = (1)k0 p1 pr be the prime factorisation of a where k0 0 or 1
and the primes pi are not necessarily distinct. Note that the primes pi(are
)
odd because a 1(mod 4). We now compute the Legendre symbol ap
using quadratic reciprocity.
( )k 0
( )
r ( )
1
pi
a
=
p
p
p
i=1
r
r ( )
p
k0 (p1)/2
(pi 1)(p1)/4
= (1)
(1)
pi
i=1
i=1
Now notice the identity
k0 +
i=1
On the left we simply have modulo 2 the number of primes pi which are
1(mod 4) and the sign of a. When this total is odd we have a
1(mod 4), when it is even we have a 1(mod 4). So we get
( )
r ( )
a
p
(a1)(p1)/2
.
= (1)
p
p
i
i=1
( p )
pi
136
(5.7.14(a)) Notice that the sum [ p] + + [ kp] equals the number of lattice point,
.
2
p
l=1
Note that
]
{ 2}
y2
y
y2
=
.
p
p
p
Take the sum for y= 1, 2, . . . , (p 1)/2. The rst part can be summed
using the formula nl=1 n2 = 16 n(n + 1)(2n + 1). The sum of the second
part is precisely equal to K/p where K is the sum of the quadratic residues
modulo p. In case p 1(mod 4) this equals half the sum of all residue
classes, which is p(p 1)/2.
(7.5.1) The sum nX r2 (n) equals the number of lattice points within the disc
137
(7.5.5) We write n = 2k [(3/2)k ]1 as sum of k-th powers. Since n < 3k , it can only
be written as repeated sum with terms 1k , 2k . The most economic way to
do this is to use as many terms 2k as possible. The remainder can then be
written as a sum of ones. Note that [n/2k ] = [(3/2)k ] 1 and the remainder
after division of n by 2k is 2k 1. So we require [n/2k ] 1 terms 2k and
2k 1 terms 1k . Hence g(k) 2k + [(3/2)]k 2.
(7.5.6) From the identity it follows that a number of the form 6m2 can be written
as a sum of 12 fourth powers. We simply write n = a2 +b2 +c2 +d2 (possible
by Lagranges theorem) and use the identity.
From the hint: n = 6N + r and write N as sum of four squares, we deduce
that 6N can be written as the sum of 4 12 = 48 squares. Now choose r
such that 0 r 5 and write r as sum of r terms 14 . We conclude that
g(4) 48 + 5 = 53.
To get a renement, note that r need not be chosen between 0 and 5. We
can also choose among the remainders 0, 1, 2, 33, 16, 17, each which is the
sum of at most two fourth powers. Hence g(4) 48 + 2 = 50.
(9.8.1) We can assume that a, b, c form a Pythagorean triple. Suppose, without loss
of generality, that b is even. Then there exist r, s such that a = r2 s2 , b =
2rs, c = r2 + s2 . Hence abc = 2rs(r4 s4 ). If r or s is divisible by 5
we are done. If r, s are not divisible by 5 we have r4 1(mod 5) and
s4 1(mod 5). Hence r4 s4 1 1 0(mod 5). So r4 s4 is divisible
by 5.
(9.8.2) Note that x, y, z 2 is a Pythagorean triple. Assume that y is even, the
case x even being similar. Then there exist r, s N, with gcd(r, s) = 1
and distinct parity, such that x = r2 s2 , y = 2rs, z 2 = r2 + s2 . Note
that r, s, z is again a Pythagorean triple. Now suppose r is even. Then
there exist integers p, q, with gcd(p, q) = 1 and distinct parity, such that
r = 2pq, s = p2 q 2 , z = p2 + q 2 . So we conclude that
x = (2pq)2 (p2 q 2 )2 = p4 + 6p2 q 2 q 4 ,
y = 4pq(p4 q 4 ),
z = p2 + q 2 .
y = 4pq(p2 q 2 ),
z = p2 + q 2 .
138
139
2y + 1 = u3 and 2y 1 = v 3 are cubes. Hence u3 v 3 = 2. The dierence
of two cubes can only be 2 when u = 1, v = 1. One way to see this is to
note that (u v)(u2 + uv + v 2 ) = 2. Hence u2 + uv + v 2 = 1, 2. The
solutions are then found by trying.
So the nal solution is y = 0, x = 1.
(9.8.10) We prove the rst statement by induction on n. For n = 1 we note that 8
n
n1
n1
divides 32 1. For larger n we remark that 32 1 = (32 1)(32 + 1)
n1
and use the induction hypothesis 2n1 divides 32
1 and the fact that
the second factor is even.
We take ck = 32 , a = 1, b = ck 1. From the above remark we know that
2k+2 divides bk . Note that
k
N (ak bk ck ) 3N (bk )
3
b
<
ck .
k
2k+1
2k+1
x3 < x3/2 .
140
(10.3.1) To show part (a) we expand each factor in the product as a geometric series
1
1
1
1
=
1
+
+
+
+
1 ps
ps p2s p3s
Taking the product we see that
pX,p
1
1 ps
prime
equals the sum of n1s over all n which consist entirely of primes X. This
is certainly larger than the sum of n1s over all n X.
We should actually have X > 3 in part (b). To show part (b) one uses the
integral criterion
X1 dt
>
= log(X 1)
t
1
nX
With a bit more case we can also get the lower bound log(X):
X1
dt
>1+
= 1 log(2) + log(X 1) > log(X).
t
2
nX
From (a) and (b) with s = 1 it follows that
pX,p
1
> log(X).
1
1
p
prime
pX,p prime
Some calculus shows that log(1 x) < x + 4x2 /5 for all x [0, 1/2].
Hence
4
1
+ 2 > log log(X).
p 5p
pX,p prime
Notice also that the sum of 1/p2 over all primes p can be bounded above
by the sum of 1/n2 over all integers n = 1, 4. The latter sum equals 2 /6
1 1/16 = 0.58.... Times 4/5 this yields a number < 1/2. So we get
1
1
+
> log log(X)
2 pX,p prime p
as desired.
F.Beukers, Elementary Number Theory
141
(10.3.4) Notice that
p2 + 1
=
21
p
p prime
=
p
p2 1
(p2 1)2
prime
1 p4
(1 p2 )2
prime
(2)2
( 2 /6)2
5
= 4
= .
(4)
/90
2
(10.3.5) Notice that, by denition, n = (pn ). Hence, by the prime number theorem,
1 pn
= 1.
n n log(pn )
lim
This follows from the fact that for suciently large n we have
1 pn
pn
<n<2
,
2 log(pn )
log(pn )
which implies
log(pn ) log log(pn ) log(2) < log(n) < log(pn ) log log(pn ) + log(2).
After division by log(n) and letting n we nd the desired limit.
(10.3.7) From the previous exercise we know that pn , the n-th prime is asymptotic
1
2
< f inite part +
.
p
log(p)
n
log(n)
log(n)/2
prime
n large
142
(11.4.3) Suppose that e+ and e are rational. Then the polynomial (X e)(X )
has rational coecients. Hence its zeros e, would be quadratic numbers,
contradicting the fact that e is transcendental.
(11.4.4) Suppose the series has a rational value, say p/q. Choose k and consider the
dierence
( )n
p
4
1
k
=
n=0
.
q
5
3n2
2
4
1
=
.
5
3n2
n=k+1
<
n (k+1)2
(4/5) 3
(k+1)2
<3
2
(4/5)n = 5 3(k+1) .
n=0
n=k+1
Chapter 13
Appendix: Elementary algebra
13.1
In this section we consider some elementary facts on nite abelian groups. The
main application in this course will be to groups of the form (Z/mZ) , the invertible residue classes modulo m. So, if one does not like to work with general
groups one should simply read (Z/mZ) whenever the expression nite abelian
group is used. The order of a nite group is simply the number of elements it
contains.
Lemma 13.1.1 Let G be a nite abelian group of order |G|. Then a|G| = e for
any a G.
P =
g=
ag.
gG
gG
gG
Remark 13.1.2 Lemma 13.1.1 is actually true for any nite group, also the nonabelian ones. The proof we gave here, due to Lagrange, works only for abelian
groups.
Definition 13.1.3 Let G be a nite group and g G. The smallest positive
integer k such that g k = e is called the order of g. Notation: ord(g).
Lemma 13.1.4 Let G be a nite group and g G. Suppose g k = e. Then
ord(g)|k.
143
144
145
On the one hand this determinant equals i<j (gi gj ). On the other hand,
since gik = 1 i, we have = 0. Since R has no zero divisors this implies that
gi = gj for some i = j, contradicting our choice of distinct elements. So we must
assume that k = |G| and, by Lemma 13.1.10 , G is cyclic.
2
As we said before, the main application of this section is to groups of the form
(Z/mZ) . In particular, Z/pZ is a eld when p is prime. Lemma 13.1.11 implies
that (Z/pZ) is a cyclic group. This can be illustrated by the following example
modulo 13. We have
(Z/13Z) = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
A possible generator of (Z/13Z) is the element 2. Indeed,
(21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 210 , 211 , 212 ) (2, 4, 8, 3, 6, 12, 11, 9, 5, 10, 7, 1)
and we see that every invertible residue class modulo 13 is a power of 2 modulo
13.
Lemma 13.1.12 Let R be a domain and G a nite subgroup of R . Then,
{
1 if 1 G
g=
1 if 1 G
gG
g
gG
146
13.2
Euclidean domains
13.3
147
Gaussian integers
13.4
Quaternion integers
148
= j2 =
= k,
= i,
= j,
k2
ji
kj
ik
= 1,
= k,
= i,
= j.
Notation: H
With the above addition and multiplication the quaternions form a (non-commutative)
domain. The conjugate of a quaternion = a+bi+cj+dk is given by abicjdk
and denoted by . The norm of a quaternion = a + bi + cj + dk is given by
N = and equals a2 + b2 + c2 + d2 (verify!). This implies that the inverse of
a non-zero quaternion exists and is given by /N . Furthermore,
Theorem 13.4.2 Let and be quaternions. Then N = N N .
Proof. Write = a + bi + cj + dk and = a + b i + c j + d k. Then,
(a + bi + cj + dk)(a + b i + c j + d k) =
= (aa bb cc dd )
+(ab + ba + cd dc )i
+(ac bd + ca + db )j
+(ad + bc cb + da )k
Our statement now follows from Eulers identity,
(a2 + b2 + c2 + d2 )(a2 + b2 + c2 + d2 ) =
= (aa bb cc dd )2
+(ab + ba + cd dc )2
+(ac bd + ca + db )2
+(ad + bc cb + da )2 .
2
An alternative way to describe quaternions is to identify a + bi + cj + dk with
the matrix
(
)
a + bi c + di
c + di a bi
where i = 1. Addition and multiplication of quaternions comes down to addition and multiplication of the corresponding matrices. The matrix corresponding
to the conjugate reads
(
)
a bi c di
.
c di a + bi
F.Beukers, Elementary Number Theory
149
150
13.5
Polynomials
Let F be a eld and F [X] the corresponding polynomial ring in one variable. As
well known, any non-zero polynomial f F [X] has a degree, which we denote by
deg(f ). We have deg(f g) = deg(f ) + deg(g) and deg(f + g) deg(f ) + deg(g).
Theorem 13.5.1 Let F [X] be a polynomial ring over a eld F . Then,
a) F [X] is a euclidean domain with the function g(f ) = 2deg(f ) if f 0.
b) f F [X] if and only if f is a constant non-zero polynomial.
Proof. Property (a) follows from the well-known division algorithm for polynomials. Property (b) is a consequence of Lemma 13.2.4
Index
amicable numbers, 17
Bertrands postulate, 110
Cantor diogonal, 121
Carmichael numbers, 34
character, 62
circle method, 78
conductor, 100
congruent, 21
congruent number, 95
conjugate, 85
continued fraction algorithm, 82
convergents, 83
critical strip, 109
decryption, 44
descent, 97
diophantine equation, 94
Dirichlet character, 64
discriminant, 85
divisor sum, 15
encryption, 44
euclidean algorithm, 9
Euler product, 109
even character, 65
Fermat numbers, 37, 54
Gauss sum, 65
greatest common divisor, 7
Hilbert tenth problem, 94
invertible, 21
irrational, 117
Jacobi sum, 66
Jacobi symbol, 56
Jacobsthal sum, 69
lcm, 11
Legendre symbol, 47
lowest common multiple, 11
Mersenne numbers, 17, 37
Mersenne prime, 17
minimal period, 28
minimal polynomial, 85
Mordell equation, 99
negative resdue class, 49
non-residue, 47
odd character, 65
partial fractions, 83
perfect number, 17
period, 28
periodic, 28
periodic continued fraction, 86
Pollard rho, 40
positive residue class, 49
primitive root, 25
principal character, 62
public key, 44
purely periodic, 28, 86
Pythagorean triplet, 95
quadratic
quadratic
quadratic
quadratic
irrational, 85
non-residue, 47
reciprocity, 48
residue, 47
radical, 100
reciprocity law, 67
151
152
reduced quadratic irrational, 85
relatively prime, 7
repunits, 53
residue class, 21
Riemann hypothesis, 109
secret key, 44
sieve methods, 111
terminate, 82
totient function, 24
transcendental, 120
trivial character, 62
twin prime, 110
Warings problem, 78
witness, 35
zer-knowledge proofs, 45
INDEX