Number Theory Lecture Notes
Number Theory Lecture Notes
Contents
1 Integers 2
1.1 Algebraic operations with integers . . . . . . . . . . . . . . . . . . 2
1.2 The well ordering principle (WOP) . . . . . . . . . . . . . . . . . 3
1.3 The pigeonhole principle . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Principle of mathematical induction . . . . . . . . . . . . . . . . . 4
1.5 Sums and Products . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.5.1 Properties of sums and products . . . . . . . . . . . . . . . 5
2 Divisibility 6
2.1 Representation of integers in different bases . . . . . . . . . . . . 8
4 Prime numbers 12
4.1 Algorithm of the Sieve of Eratosthenes . . . . . . . . . . . . . . . 13
4.2 Least/lowest common multiple(LCM) . . . . . . . . . . . . . . . . 18
4.3 Fermat Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.4 Linear Diophantine equations (LDE) . . . . . . . . . . . . . . . . 21
8 Primitive Roots 46
10 Quadratic residues 51
References 53
2 Abubakar Mwasa
1. Integers
“It takes a village to count integer points.”
Before we discuss integers, we explain what natural (whole) numbers are. Nat-
ural numbers are written using ten numerals 0, 1, 2, ... , 9, where the position of
the numeral dictates e.g. 1246 stands for 1 thousand, 2 hundreds, 4 tens and 6
units(ones). Here, numerals 1, 2, 4 and 6 are called the thousands, hundreds, tens
and unit coefficients. This is place value principle. A set of all natural numbers
is denoted by N = {0, 1, 2, ...}. Natural numbers can be represented by equally
space points on a straight line (number line) i.e.
fig 1
On the number line, numbers to the left of a given number are less than < the
given number and numbers to the right are greater than > the given number, i.e.
from above figure fig 1, a < b or b > a. If the number line in fig1 is extended to
the left of zero i.e.
fig 2
We obtain negative (−) of natural numbers. These negative and positive natural
numbers together with zero are called integers. The set of integers are denoted
by Z = Z+ ∪ {0} ∪ Z− , where Z+ = {1, 2, ...} and Z− = {... , −2, −1}.
It follows from WOP, that a set of positive integers N is well ordered. However,
rational numbers, Q, are not well-ordered. To see this, let x be the smallest
element in Q. Then x − 1 is a rational number that is smaller than x, which
contradicts the minimality of x. So the set Q does not have a smallest element,
thus it is not well-ordered.
Proof. Suppose that none of the boxes contains more than one object. Then there
are at most k objects. A contradiction since there are s objects for s > k.
4 Abubakar Mwasa
1
X 1
Y
Thus for n = 1, aj = a1 ; aj = a1 .
j=1 j=1
2
X 2
Y
For n = 2, aj = a1 + a2 ; aj = a1 a2 .
j=1 j=1
20
Y
(d) 5 = 520 .
k=1
2. Divisibility
In this section, we will discuss the concept of divisibility and its properties.
Proof. (iii) Since a|b and b|c, then there exist x1 , x2 ∈ Z such that b = x1 a and
c = x2 b. From which, we have that c = x2 x1 a. Thus a|c since x2 x1 is an
integer.
(iv) Since c|a and c|b, there exist x1 , x2 such that a = x1 c and b = x2 c. Thus
xa + yb = x1 xc + yx2 c = c(x1 x + yx2 ). Implying that c|(xa + yb).
Number Theory Lecture Notes 7
By the way, Proposition 2.2(iv) can be generalised to any finite linear combi-
nation, i.e. if
n
X
a|b1 , a|b2 , ... , a|bn , then a| kj bj for kj ∈ Z.
j=1
Theorem 2.3. [Division algorithm]. If a and b are integers such that b > 0, then
there exist unique integers q and r such that a = bq + r and 0 ≤ r < b.
214 = 3(71) + 1
71 = 3(23) + 2
23 = 3(7) + 2
7 = 3(2) + 1
2 = 3(0) + 2
(214)10 = (21221)3 .
It is also called highest common factor (HCF). We denote the greatest common
divisor of two numbers a, b by (a, b). In some literature, you will find gcd(a, b).
Note that (0, 0) = 0. If c, c′ are two greatest common divisors of a, b, then c|c′
and c′ |c. Thus, we must have that c′ = ±c. So because of this, we take the
greatest common divisor as positive i.e. (a, b) = (|a|, |b|).
Example 3.2. Find
(a) (24, 18)
(b) (12, −15)
Solution. We list the factors of each integer and pick out the greatest common
that belongs to both.
factors of 24 = {1, 2, 3, 4, 6, 12, 24} and factors of 18 = {1, 2, 3, 6, 9, 18}. Observe
that the common divisors are {1, 2, 3, 6} and the greatest among them is 6. Thus,
(24, 18) = 6.
Check in a similar way that (12, −15) = 3.
The above way of finding the greatest common divisor becomes difficult once
the numbers are large. Thanks to Euclidean algorithm that saves us. We will
discuss it shortly.
Definition 3.3. Two integers a and b are relatively prime (coprime) if (a, b) = 1.
For instance, (3, 4) = (7, 9) = 1 are relatively prime. In fact, the following
simple result show that all consecutive integers are relatively prime.
Lemma 3.4. Every two consecutive positive integers are relatively prime.
Proof. Let n and n + 1 be consecutive positive integers. Let d = (n, n + 1). Thus,
d|n and d|n + 1, implying that n = dr and n + 1 = ds for some r, s ∈ Z. So
dr + 1 = ds or d(s − r) = 1. Now, because s − r is an integer, it implies that d|1,
i.e. d ≤ 1. Similarly, d ≥ 1 and so d = 1.
Theorem 3.5. If (a, b) = d, then (a/d, b/d) = 1.
Proof. Let k be a positive common divisor such that k|a/d and k|b/d. So there
exist m, n ∈ Z+ such that a/d = km and b/d = kn or a = kmd and b = knd.
Observe that kd is a common divisor of both a and b. And off course kd ≥ d
since k ∈ Z+ . But (a, b) = d, so the integer k must be 1 (k = 1).
The following result shows that the greatest common divisor of two integers
does not change when a multiple of one of them is added.
Theorem 3.6. Let a, b and k be integers. Then (a, b) = (a + kb, b).
Proof. Let d be a common divisor of a and b. By Proposition 2.2 (iv), d|(a + kb),
hence d is a divisor of a + kb. Now assume c is a common divisor of a + kb and b,
then by Proposition 2.2 (iv), we have that c|((a + kb) − kb) = a. Implying that
c is a common divisor of a and b.
10 Abubakar Mwasa
Theorem 3.8. [Bezout’s Identity] The greatest common divisor of two integers
a and b, not both zero is the least positive integer such that ma + nb = d for some
integers m and n.
Proof. First consider a set of all positive integer linear combinations of a and b.
Note that this set is nonempty since a = 1 · a +0 · b and b = 0 · a +1 · b. This means
that the set has a least element d = ma + nb for some m, n ∈ Z, by well ordering
principle. By the division algorithm theorem, we have a = dq + r, 0 ≤ r < d. or
Definition 3.9. Let a1 , a2 , ... , an be integers not all 0. The greatest common
divisor of these integers is the greatest integer that divides all in the set, denoted
by (a1 , a2 , ... , an ). And they are mutually relatively prime if (a1 , a2 , ... , an ) = 1.
The inequality 0 ≤ nk < nk−1 indicates that n′k s form a decreasing sequence of
nonnegative integers, so the algorithm terminates.
Illustration. Set nk = rk . By applying division algorithm, we have that
r0 = r1 q1 + r2 , 0 ≤ r2 < r1 ,
r1 = r2 q2 + r3 , 0 ≤ r3 < r2 ,
...
84 = 1(60) + 24
60 = 2(24) + 12
24 = 2(12).
12 Abubakar Mwasa
4. Prime numbers
Every positive integer can be written uniquely as a product of prime numbers
e.g. 15 = 3 · 5, 60 = 22 · 3 · 5. Thus, they are building blocks of integers. So it is
worth wondering how primes are distributed among integers.
Definition 4.1. A positive natural number p ∈ N for which p > 1 whose only
integer factors are ±1 and ±p is a prime.
Alternatively, one defines it as an integer p > 1 that is only divisible by 1 and
itself. Otherwise such a natural number is called composite. Examples of primes
include 2, 3, 5, 7, 11, 13, 17 and so on. Note that apart from 2, all primes are odd
since every even integer is divisible by 2.
Lemma 4.2. Every integer greater than one has a prime divisor.
Proof. Suppose there is an integer greater 1 that has no prime divisors. Since the
set of integers with elements greater than 1 with no prime divisors is nonempty,
then by well ordering principle, there is a least positive integer n > 1 that has
no prime divisors. Thus n is composite since n|n. Hence, n = ab with 1 < a < n
and 1 < b < n. Note that a < n and as a result since n is the least, a must have
a prime divisor which also is a divisor of n, contradiction.
Theorem 4.3. If n is a composite integer, then n has a prime factor not exceeding
√
n.
strike off all multiples of the next prime from the list.
Repeat
√ until no more multiples are found of the prime integers that are less
than n.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
50
√
After striking out the multiples of primes ≤ 50, we have that primes less
than 50 are
{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47}.
Proof. If to the contrary, there are only finitely many primes p1 , p2 , ... , pn . Check
for p1 p2 ... pn + 1. This is not divisible by any of the primes p1 , P2 , ... , pn since
it leaves a remainder of 1 when divided by any of them. By Lemma 4.2, every
number greater than 1 is divisible by a prime. Contradicting the assertion, so
there are infinitely many primes.
Theorem 4.6. For each positive integer n, there exists n consecutive composite
integers.
Note that every integer in the sequence is composite because k divides (n+1)!+k
if 2 ≤ k ≤ n + 1, by Proposition 2.2 (iv), i.e.
(n + 1)! + k = 1 · 2 · 3 · ... k(k + 1) ... n(n + 1) + k
= k(1 · 2 · 3 · ... (k − 1)(k + 1) ... n(n + 1)) + k
= k(1 · 2 · 3 · ... (k − 1)(k + 1) ... n(n + 1) + 1)
Thus one can produce any number of consecutive composite integers. Indeed
(n + 1)! + 2 is divisible by 2, 3 divides (n + 1)! + 3, and so on. For instance, if a
sequence of 4 consecutive composite integers is desired, then
5! + 2 = 122 = 2 · 61
5! + 3 = 123 = 3 · 41
5! + 4 = 124 = 4 · 31
5! + 5 = 125 = 5 · 25
Exercise 4.7. (a) Find the smallest five composite consecutive integers.
(b) Establish that the sequence
(n + 1)! − 2, (n + 1)! − 3, ... , (n + 1)! − (n + 1)
produces n consecutive composite integers for n > 2.
(c) Three integers p, p+2 and p+6 which are all prime are called prime triplets.
Find five sets of prime triplets.
√
(d) Let p be a prime. Prove that for each n > 1, n p is not a rational number.
(e) Prove that every prime of the form 3k + 1 is necessarily of the form 6m + 1
Remark 4.8. How are primes distributed? Are they evenly distributed or sparsely.
The prime number theorem (PNT) gives an asymptotic estimate π(n), which
is the number of primes that approximately equal to lnnn , i.e.
π(n)
lim = 1.
n→∞ n/ ln n
The prime number theorem was first conjectured by Legendre and Gauss. First
proofs were given by Hadamard and de La Vallel Poussin in 1896. Other proofs
by Atle Selberg and Paul Erdös were in the 1930s.
Example 4.9. Estimate the number of primes less than 1000000.
Solution. By PNT,
1000000
π(1000000) ≈ ≈ 72382.
ln(1000000)
The actual number of primes less than 1000000 is 78498.
Number Theory Lecture Notes 15
Special forms of primes are numbers written as a string of ones (1s). For
instance, 11, 111, 1111 and so on, called repunits, denoted Rn , where n represents
n
the number of digits. Here Rn = 10 9−1 . For Rn to be prime, n must be a prime
number. Though, this is not a sufficient condition since R5 = 11111 = 41 · 271
and R7 = 1111111 = 239 · 4649.
By the way, there are many unsolved problems about distribution of primes.
For instance, there are primes that come in pairs (2 units apart) such as 5 and
7, 11 and 13. they are called twin primes.
Here are some of the unsolved problems
(a) Two prime conjecture. Are there infinitely many twin (p, p + 2 both prime)
primes? The largest pair currently known was discovered in September
2016, and are
2996863034895 · 21290000 ± 1, with 388342 digits.
There are 808, 675, 888, 577, 436 twin prime pairs below 1018 , see [1].
(b) We first define what Fibonacci numbers are. The Fibonacci sequence is the
series of numbers where each number is the sum of the two preceding num-
bers. For example, 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ..., are Fibonacci
numbers. Mathematically, expressed by the formula
xn = xn−1 + xn−2 (4.1)
Fibonacci numbers that are primes from the above list are 2, 3, 5, 13. Are
there infinitely many prime Fibonacci numbers?
(c) Mersenne prime conjecture. There are infinitely many Mersenne primes i.e.
primes of the form 2n − 1. Note that if 2n − 1 is prime, then n itself must
be prime. The largest known prime as of December 2020, discovered by
Patrick Laroche of the great internet Mersenne prime search (GIMPS) in
2018, is the 51st known Mersenne prime
p = 282589933 − 1 with 24862048 digits.
(d) Goldbach conjecture. This is a very famous open problem concerning
primes perceived by C. Goldbach. It asserts that G every even integer
can be written as a sum of two numbers that are either primes or 1. For
instance
2=1+1
4=2+2=1+3
6=3+3=1+5
8=3+5=1+7
10 = 5 + 5 = 3 + 7
12 = 5 + 7 = 1 + 11
14 = 3 + 11 = 7 + 7 = 1 + 13.
16 Abubakar Mwasa
And in fact if one takes integers ≥ 4, then the conjecture can be reformu-
lated as “ Every even integer greater 4 can be written as a sum of two odd
primes”. So far either a proof or a counter example has not been found.
(e) There are infinitely many primes of the form n2 + 1, n ≥ 1.
Euler encountered with a conjecture of his own; “Any even integer greater or
equal to 6 of the form 4n + 2 is a sum of two numbers each being either a prime
of the form 4n + 1 or 1.
Proof. If p|a, we are done. If p ∤ a, then (p, a) = 1, since only 1 and p divide
p. Or (p, a) = p but the latter implies p|a, contradicting the assumption. Thus
(p, a) = 1. Let m, n ∈ Z be such that mp + na = 1. Then mpb + nab = b and so
p|b.
p1 = q1 , p 2 = q 2 , p r = qs .
Number Theory Lecture Notes 17
Proof. For each j, ptj |a and ptj |b, hence ptj |(a, b). Then pt11 ... ptkk |(a, b) by Theo-
rem 4.10. If
(a, b)
1 < m = t1 ,
p1 ... ptkk
then m|(a, b) and there is a prime q|m, hence q|a and q|b. This means that q = pl
for some l and so ptl l +1 |(a, b). But then prl l +1 |a and psl l +1 |b which is impossible.
Hence, (a, b) = pt11 ... ptkk .
Note that if n = pr11 pr22 ... prkk where all pj are distinct for 1 ≤ j ≤ k, one would
write as Y a
n= pj j .
∀pj
120 = 2 · 2 · 2 · 3 · 5 = 23 · 3 · 5.
Theorem 4.17. There are infinitely many primes of the form 4n + 3, when n is
a positive integer.
18 Abubakar Mwasa
Proof. Suppose there are finitely many primes of the form 4n + 3, say p0 = 3,
p1 , p2 , ... pn . Let N = 4p1 p2 ... pn + 3. Note that any odd prime is of the form
4n + 1 or 4n + 3. So there exists at least one prime in N of the form 4n + 3
or else N is of the form 4n + 1. Note that if 3|N , then 3|(N − 3) and hence
3|4p1 ... pn which is impossible since pi ̸= 3 for every i. Hence, 3 ∤ N . Also other
primes p1 , p2 , ... , pn ∤ N because if pi |N , then pi |(N − 4p1 ... pn ) = 3. Hence none
of p0 , p1 , ... , pn divides N . Thus there are infinitely many primes of the form
4n + 3.
Exercise 4.18. (a) Find the prime factorization of 32, 900 and 221122.
(b) Show that there are infinitely many primes of the form 6k + 5.
(c) List the first 10 primes of the form 4n − 1.
min(a, b) + max(a, b) = a + b
(i) [a, b] ≥ 0
ab
(ii) [a, b] = (a,b)
(iii) Since a|m and b|m, then there exist x, y ∈ Z such that ax = m and by = m,
so that ax = m = by. In other words, b|ax. If (a, b) = d, then db |x so that db k1 = x
for some k1 ∈ Z. Hence,
m = ax = a(b/d)k = (ab/d)k
ab ab
i.e. d
|m and from Theorem 4.21 (ii) d
= [a, b].
Example 4.22. Given 36 and 90. Find [36, 90] and (36, 90).
Solution. Write 36 and 90 in terms of prime factors i.e. 36 = 22 · 32 and
90 = 2 · 32 · 5. Thus,
Now we have that 27 · 5 = 641 − 1, so (27 · 5)4 = (641 − 1)4 = 641x + 1, where x
is an integer. Also 54 = 641 − 24 , so
228 (641 − 24 ) = 641x + 1
641 · 228 − 232 = 641x + 1
232 + 1 = 641(228 − x),
which proves that 641|232 + 1. Actually, Fn , for 5 ≤ n ≤ 32 is composite.
Definition 4.24. A Fermat prime is a Fermat number which is prime.
It is still an open problem whether there are infinitely many Fermat numbers.
Surprisingly, Fermat primes arise in deciding whether a regular n-gon (convex
polygon with n equal sides) can be constructed with a compass and a straight
edge. Gauss showed that this can be constructed if and only if n is a power of
2 times a product of distinct Fermat primes. Here are some of the properties of
Fermat primes.
(a) If p is prime and p|Fn , then p = k · 2n+2 + 1 for some k ∈ Z.
4
Example 4.25. Check F4 = 22 + 1 = 65537 for primality.
Solution. Here n =√4, all primes are of the form k · 26 + 1 = 64k + 1. We
check for primes ≤ 65537 ≈ 256.
k 64k + 1 conclusion
1 65 Not prime
2 129 Not prime
3 193 prime, but 193 ∤ 65537
4 257 257 > 256
Therefore, 65537 must be prime.
(b) F0 F1 ... Fn−1 = Fn − 2 for n > 0.
This can be proved by induction. For n = 1, we have F0 = 3, F1 = 5, so
F0 = F1 − 2, true.
Take n > 0, let us assume that it is true for n. We now prove for n + 1.
F0 F1 ... Fn−1 , so F0 F1 ... Fn−1 Fn = (Fn − 2)Fn .
Now
n n n n+1 n+1
(Fn −2)Fn = (22 −1)(22 +1) = 22·2 −1 = 22 −1 = 22 +1−2 = Fn+1 −2
Also holds for n + 1. Thus, holds for all n > 0.
(c) If m ̸= n, (Fm , Fn ) = 1.
Proof. Let m < n or else switch. Let p be prime and p|Fm and p|Fn .
Also p|F0 F1 ... Fn−1 since m < n implies that Fm occurs in the product.
But Fn − 2 = F0 F1 ... Fn−1 , so 2 = Fn − F0 F1 ... Fn−1 . Since p|Fn − 2
and p|F0 F1 ... Fn−1 , then p|2, so p = 2. This is impossible since all Fn′ s
are odd. Implying there is no prime that divides both Fm and Fn , hence
(Fm , Fn ) = 1.
Number Theory Lecture Notes 21
Remark 4.26. Knowing that primes becomes scarce as the list of positive inte-
gers grows, any Mathematician would be happy if there is a formula that generate
all primes. Some Mathematicians tried on some quadratic polynomials, one of
such polynomial is f (n) = n2 +n+41, which did give primes for n = 0, 1, 2, ... , 39.
However, for n = 40, f (40) = 412 and for n = 41, f (41) = 41 · 43, not prime was
shown by Euler. But again f (42) = 1847 is prime.
x = rc + bt, y = sc − at,
117 = 17 · 6 + 15
17 = 15 · 1 + 2
15 = 2 · 7 + 1
2=1·2
1 = 15 − 2 · 7 = 8 · 15 − 7 · 17 = 8 · 117 + (−55)17.
But x > y, so −1200 + 5t > 300 − 12t or t > 247.05. So from (4.2),
248 ≤ t ≤ 250 or t = {248, 249, 250}. Thus, the possible solutions are for
t = 248; x = 40, y = 24
t = 249; x = 45, y = 12
t = 250; x = 50, y = 0
(f) Shakira buys large blouse for shs.18000 and a small one at shs.11000. The
blouses cost a total of shs.118000. What is the smallest total number of
blouses she could have bought.
Solution. Let x be the number of large blouses and let y be the number of
small blouses. Then 18000x + 11000y = 118000 or 18x + 11y = 118. Since
(18, 11) = 1|118, there are solutions.
Using Euclidean Algorithm, check that 18(−3) + 11 · 5 = 1. And 18 ·
(−354) + 11 · 590 = 118. Thus x = −354, y = 590 is a particular solution.
The general solution is x = −354 + 11t, y = 590 − 18t. Since x ≥ 0, y ≥ 0
(number of blouses has to be positive),
So −354+11t ≥ 0 or t ≥ 254/11 ≈ 32 and 590−18t ≥ 0 or t ≤ 590/18 ≈ 33,
i.e. 32 ≤ t ≤ 33.
Total number of blouses x + y = (−354 + 11t) + (590 − 18t) = 236 − 7t.
For 32 ≤ t ≤ 33, the smallest for t = 33, we have that y = 0, x = 5 and
x + y = 5. So she bought 5 large blouses, no small blouses and a total of 5
blouses.
The results can be extended to linear Diophantine equations with more than
two variables. That is, let a1 , a2 , ... , an be nonzero integers. Then the linear Dio-
phantine equation a1 x1 + ... + an xn = c has a solution if and only if (a1 , ... , an )|c.
Furthermore, if the equation has at least one solution, then it is infinitely many
solutions.
Example 4.31. Find all integer solutions of the linear Diophantine equation
24 Abubakar Mwasa
(i) 3x − 6y + 5z = 4,
(ii) 8x + 14y + 5z = 11
Solution.
(i) The equation 3x − 6y + 5z = 4 has solutions since (3, −6, 5) = 1|4.
Now let k = −6y + 5z
3x + k = 4 (4.3)
By inspection, we see that (x, k) = (1, 1) is one particular solution of the
equation (4.3). And the general solutions of (4.3) are x = 1 + t, k = 1 − 3t,
t ∈ Z. Observe that
−6y + 5z = 1 − 3t (4.4)
And y0 = z0 = −1 + 3t is one solution of equation 4.4. (Generally speaking,
one would find a particular solution in the form y0 = a0 +a1 t, z0 = b0 +b1 t).
Thus, we conclude that all solutions (x, y, z) of 3x − 6y + 5z = 4 are given
by x = 1 + t, y = −1 + 3t + 5u, z = −1 + 3t + 6u, t, u ∈ Z.
(ii) Let 2(4x + 7y) + 5z = 11, and 2w + 5z = 11 where w = 4x + 7y. By
Euclidean Algorithm (EA),
1 = 5 + (−2)2 and so
11 = 11 · 5 + (−22) · 2
The particular solution to 2w + 5x = 11 is w0 = −22 and z0 = 11 and the
general solution w = −22 + 5s and z = 11 − 2s so
4x + 7y = w = −22 + 5s,
4x + 7y = −22 + 5s by EA
7=1·4+3
4 = 1 · 3 + 1 by back substitution
1 = 2 · 4 + (−1)7
multiplying through by −22 + 5s, we get
−22 + 5s = (−44 + 10s) · 4 + (22 − 5s) · 7
and so x = −44 + 10s, y = 22 − 5s
Thus, the general solution is x = −44+10s+7t, y = 22−5s−4t, z = 11−2s.
Example 4.32. A farmer wishes to buy 100 animals and spend exactly $100.
Cows are $10, sheep $3 and rabbits $0.50. Is this possible?
Solution. Let c represent cows, s for sheep and r for rabbits.
c + s + r = 100 (4.5)
10c + 3s + 0.50r = 100 (4.6)
Making r the subject in (4.5) and substituting in equation (4.6), we have that
19c + 5s = 100
Number Theory Lecture Notes 25
Observe that (19, 5) = 1|100, the equation has infinitely many solutions. Check
that 100 = 19(−100) + 5(400). Hence c = −100, s = 400 is a particular solution.
And the general solution is c = −100 − 5t, s = 400 + 19t. Since we need c, r, s to
be positive, we have that −100 − 5t ≥ 0 and 400 + 19t ≥ 0. −20 > t and −21 ≤ t
or −21 ≤ t ≤ 20. Thus t = −21 gives the unique solution in the positive integers
i.e. c = 5, s = 1, r = 94.
Exercise 4.33. (a) Either find all the solutions or prove that there are no
solutions for
(i) 21x + 7y = 147
(ii) 2x + 13y = 31
(iii) 2x + 14y = 17
(b) Find the integers x, y and z that satisfy
(i) 6x + 15y + 20z = 1
(ii) 8x + 14y + 5z = 11
Definition 5.1. Let n be a fixed positive integer. Two integers a and b are said
to be congruent modulo n, denoted by a ≡ b(mod n) if n divides the difference
a − b, i.e. a − b = kn for all k ∈ Z.
Solution.
(a) Note that 25 ≡ −9(mod 41) and so (25 )4 ≡ (−9)4 (mod 41) by property (f),
i.e. 220 ≡ 81 · 81(mod 41), but 81 ≡ −1(mod 41). Implying that 81 · 81 ≡
1(mod 41). Thus 220 − 1 ≡ 1 − 1 ≡ 0(mod 41), i.e. 41 | 220 − 1.
(b) 548 = (52 )24 = (25)24 ≡ (1)24 (mod 12). Thus 548 ≡ 1(mod 12) and the
remainder is 1.
Recall that if ab = ac for integers a, b, c, then b = c. But we cannot have
4 ≡ 10(mod 6) giving 2 ≡ 5(mod 6) since 6 ∤ (5 − 2) = 3. The following theorem
shows when such a cancellation is allowed in congruences.
Theorem 5.5. If ca ≡ cb(mod n), then a ≡ b(mod n/d), where d = (c, n).
But 15 ≡ 2(mod 13) so 113 · 114 ≡ 2(mod 13) and (113 · 114 )5 ≡ 25 (mod 13).
Therefore 1135 ≡ 6(mod 13), since 25 ≡ 6(mod 13). Hence, the remainder is
6.
And that this number x can be replaced with x = (am am−1 ... a2 a1 a0 )n . For
instance, if x = 105 and n = 2, then
x = 1 · 26 + 1 · 25 + 0 · 24 + 1 · 23 + 0 · 22 + 0 · 2 + 1, unique representation
Suppose we wish to calculate the value of ak (mod n) when k is large. Then write
j
k in binary form as k = (am am−1 ... a1 a0 )2 and the values a2 (mod n), 0 ≤ j ≤ m,
are calculated for the powers of 2, which correspond to the 1′ s in the binary
representation.
Number Theory Lecture Notes 29
110 = 1 · 26 + 1 · 25 + 0 · 24 + 1 · 23 + 1 · 22 + 1 · 2 + 0 = (1101110)2
j
Thus, we obtain powers 52 for 0 ≤ j ≤ 6 by repeatedly squaring while at each
stage reducing each result modulo 131, i.e.
52 ≡ 25(mod 131)
54 ≡ 101(mod 131)
58 ≡ 114(mod 131)
516 ≡ 27(mod 131)
532 ≡ 74(mod 131)
564 ≡ 105(mod 131)
Thus,
5110 = 564+32+8+4+2
= 564 · 532 · 58 · 54 · 52
≡ 105 · 74 · 114 · 101 · 25(mod 131)
≡ 41 · 117 · 25(mod 131)
≡ 60(mod 131)
Note that 564 · 532 = 596 ≡ 105 · 74(mod 131) ≡ 41(mod 131) and 58 · 54 = 512 ≡
114 · 101(mod 131) ≡ 117(mod 131)
Example 5.12. Find 1135 (mod 13).
Solution.
35 = 1 · 25 + 0 · 24 + 0 · 23 + 0 · 22 + 1 · 2 + 1 = (100011)2
j
Implying that 35 = 32 + 2 + 1 and now for 112 (mod 13) for 0 ≤ j ≤ 5.
11 ≡ 11(mod 13)
112 ≡ 4(mod 13)
114 ≡ 3(mod 13)
118 ≡ 9(mod 13)
1116 ≡ 3(mod 13)
1132 ≡ 9(mod 13)
Exercise 5.13. Compute (i) 1953 (mod 503), (ii) 14147 (mod 1537) (iii) 5113 (mod 131).
m
X
Theorem 5.14. Let P (x) = ck xk be a polynomial function of x with integral
k=0
coefficients ck . If a ≡ b(mod n), then P (a) ≡ P (b)(mod n).
Proof. Since a ≡ b(mod n), apply property (f) iteratively for k = 1, 2, ... , m to
get
a ≡ b(mod n), a2 ≡ b2 (mod n), ... , am ≡ bm (mod n).
Thus, cj aj ≡ cj bj (mod n) for j = 0, 1, 2, ... , m and finally,
m
X m
X
k
ck a ≡ ck bk (mod n) i.e. P (a) ≡ P (b)(mod n).
k=0 k=0
be the decimal expansions of the positive integer x, 0 ≤ ak < 10, and let S =
a0 + a1 + ... + am . Then 9|x if and only if 9|S.
m
X
Proof. Consider P (x) = ak xk , a polynomial with coefficients ak for k =
k=0
0, 1, ... , m. Observe that 10 ≡ 1(mod 9). Thus by Theorem 5.14, P (10) ≡
P (1)(mod 9). But P (10) = x and P (1) = a0 + a1 + ... + am = S. So that
x ≡ S(mod 9). It follows that x ≡ 0(mod 9) if and only if S ≡ 0(mod 9).
Proof. Because 10 ≡ −1(mod 11), we get P (10) ≡ P (−1)(mod 11). But P (10) =
N and P (−1) = a0 − a1 + ... + (−1)m am = T . So N ≡ T (mod 11). Thus either
11|N and 11|T or 11 ∤ N and 11 ∤ T .
Number Theory Lecture Notes 31
Example 5.19. Given f (x) = x5 − 10x + 7. Find the remainder of f (27) when
divided by 5.
Solution. Note that 27 ≡ 2(mod 5). By Theorem 5.14, f (27) ≡ f (2)(mod 5).
Also, 10 ≡ 0(mod 5) and 7 ≡ 2(mod 5), so that
f (27) ≡ f (2)(mod 5)
≡ 25 − 10 · 2 + 7
≡ 25 − 0 · 2 + 2
≡ 34 ≡ 4(mod 5)
In fact,
n n
x0 + (d + k) ≡ x0 + k(mod n); 0 ≤ k < d.
d d
Therefore, x0 , x0 + nd , ... , x0 + n(d−1)
d
are solutions of equation (5.1). The
argument leads to the following theorem.
Theorem 5.21. The linear congruence ax ≡ b(mod n) has a solution if and only
if d|b where d = (a, n). If d|b, then it has d mutually incongruent solutions modulo
n.
Suppose x′ is any other solution of ax ≡ b(mod n), then ax′ ≡ b(mod n). Also
ax0 ≡ b(mod n).
ax′ ≡ ax0 (mod n) (5.3)
If a = dr, n = ds, with (r, s) = 1. Then drx′ ≡ drx0 (mod n) by equation (5.3).
Implying ds = n|(drx′ − drx0 ) or s|r(x′ − x0 ) or s|x′ − x0 or x′ = x0 + hs, h ∈ Z.
By division algorithm,
h = dq + t, 0 ≤ t < d. So x′ = x0 + dqs + ts = x0 + nq + nd t. Thus, x′ ≡
x0 + nd t(mod n).
Therefore, the congruence ax ≡ b(mod n) if admits a solution x0 , has d and
only d mutually incongruent solutions x0 , x0 + nd , x0 + 2n
d
, ... , x0 + nd (d−1)(mod n).
Solution. Since (18, 42) = 6 and surely 6|30. Theorem 5.21 guarantees the
existence of exactly 6 solutions, which are incongruent modulo 42. By inspection,
x0 = 4,
Other solutions are
42
x ≡ 4 + t ≡ 4 + 7t(mod 42), t = 0, 1, ... , 5.
6
i.e. x = 4, 11, 18, 25, 32, 39.
Example 5.25. Solve the linear congruence 9x ≡ 21(mod 30).
Solution. (9, 30) = 3 and 3|21. The equivalent linear Diophantine equation
is 9x − 30y = 21.
And from Euclidean Algorithm, check that 9(−21) − 30(−7) = 21. Thus
x0 = −21 and y0 = −7. Therefore, solutions to the congruence equation are
30
x = −21 + t = −21 + 10t, t = 0, 1, 2.
3
And x ≡ −21(mod 30), x ≡ −11, −1 or x ≡ 9, 19, 29(mod 30).
Example 5.26. Solve the linear congruence 6x ≡ 15(mod 21).
Solution. Since (6, 21) = 3 and 3|15, then the congruence has a solution.
Taking x0 = 6, as a solution of 6x ≡ 15(mod 21). Other solutions are x ≡ 6 + 21
3
t,
t = 0, 1, 2. Therefore, x ≡ 6, 13, 20.
Exercise 5.27. Solving the following congruences
(a) 25x ≡ 15(mod 29)
(b) 140x ≡ 133(mod 301)
(c) 5x ≡ 2(mod 26)
(d) 99x ≡ 100(mod 101)
Having considered a single linear congruence, it is natural to turn to the
problem of solving a system of simultaneous linear congruences i.e.
a1 x ≡ b1 (mod n1 ), a2 x ≡ b2 (mod n2 ), ... , ar x ≡ br (mod nr )
where ni , i = 1, 2, ... , r are relatively prime in pairs.
Theorem 5.28. Let n1 , n2 , ... , nr be positive integers such that (ni , nj ) = 1 for
i ̸= j. Then the system of linear congruences
x ≡ a1 (mod n1 )
x ≡ a2 (mod n2 )
...
x ≡ ar (mod nr )
i.e. product of all the integers ni without nk . Then (Nk , nk ) = 1, and let x be a
unique integer such that Nk x ≡ 1(mod nk ).
Define x0 = a1 N1 x1 + a2 N2 x2 + ... + ar Nr xr . We observe that Ni ≡ 0(mod nk )
for i ̸= k because nk |Ni . Thus the result is
x0 = a1 N1 x1 + ... + ar Nr xr ≡ ak Nk xk (mod nk )
But the integer xk was chosen to satisfy the congruence Nk x ≡ 1(mod nk ), which
forces x0 ≡ ak · 1 ≡ (mod nk ). This shows that a solution to the given system of
congruence exists. For uniqueness, suppose x′ is any other integer that satisfies
these congruences, then x0 ≡ ak ≡ x′ (mod nk ), k = 1, 2, ... , r and so nk |x0 − x′
for each value of k.
Thus, n1 n2 ... nr |x0 − x′ , hence x0 ≡ x′ (mod n).
Example 5.30. Solve the Sun-Tsu problem that corresponds to the system of
three congruences
or
x ≡ 0(mod 3), x ≡ 1(mod mod 4), 17x ≡ 9(mod 23).
We have that x ≡ 0(mod 3), implying that x = 3k for some k ∈ Z. Then
3k ≡ 1(mod 4) from which we have k ≡ 9k ≡ 3(mod 4), so k = 3 + 4t, t ∈ Z.
Thus,
x = 3(3 + 4t) = 9 + 12t
And,
We choose t such that 5 + 11t ≡ 2(mod 19), 11t ≡ −3(mod 19). As (11, 19) = 1,
this has a unique solution. Since t = 17 satisfies 11t ≡ −3(mod 19), therefore
x = 5 + 11 · 11 ≡ 192(mod 11 · 19) = 192(mod 209).
36 Abubakar Mwasa
Remark 5.33. Suppose we are required to solve linear congruences in two vari-
ables ax+by ≡ c(mod n), then this congruence has a solution if and only if (a, b, n)
divides c. The condition for solvability holds if either (a, n) = 1 or (b, n) = 1.
For instance, if (a, n) = 1, then ax ≡ c − by(mod n) which guarantees a unique
solution x for each of the n incongruent values of y.
Example 5.34. Solve 7x + 4y ≡ 5(mod 12)
Solution. 7x ≡ 5 − 4y(mod 12), if y ≡ 5(mod 12). 7x ≡ −15(mod 12) but
this equivalent to −5x ≡ −15(mod 12) or x ≡ 3(mod 12), y ≡ 5(mod 12) is
one of the 12 incongruent solutions of 7x + 4y ≡ 5(mod 12). Another solution
x ≡ 3(mod 12), y ≡ 8(mod 12).
Theorem 5.35. The system of linear congruences
ax + by ≡ r(mod n) (5.4)
cx + dy ≡ s(mod n) (5.5)
The assumption that (ad − bc, n) = 1 ensures that the congruence (ad − bc)z ≡
1(mod n) has a unique solution.
Multiply (5.6) by t,
x ≡ t(dr − bs)(mod n)
And for y, c(5.4) − a(5.5), (ad − bc)y ≡ as − cr(mod n).
Implying y ≡ t(as − cr)(mod n).
5x + 3y ≡ 1(mod 7)
3x + 2y ≡ 4(mod 7)
Number Theory Lecture Notes 37
Proof. Suppose that m is its own inverse, then m · m ≡ 1(mod p). Hence, p|m2 −
1 = (m−1)(m+1). In other words, p|(m−1) or p|(m+1), implying m ≡ 1(mod p)
or m ≡ −1(mod p).
Conversely, suppose that m ≡ 1(mod p) or m ≡ −1(mod p), then m2 ≡
1(mod p).
Proof. Note that if p = 2 and p = 3, the congruence holds. Now let us assume
that p > 3. Group the elements of the set {2, 3, ... , p − 2} in pairs (i, j) such that
i · j ≡ 1(mod p). Off course i ̸= j, otherwise the number (i − 1)(i + 1) would be
divisible by p, which is impossible due to that fact 0 < i − 1 < i + 1 < p. We
38 Abubakar Mwasa
already know from Theorem 6.1 that 1 and p − 1 are their own inverses. Hence
coupling the integers from 2 to p − 2 each with its inverse, it follows that their
product is 1. We get
2 · 3 · ... · (p − 2) ≡ 1(mod p)
and thus
(p − 1)! = 1 · 2 · 3 ... (p − 2)(p − 1) ≡ 1 · 1 · (p − 1) ≡ −1(mod p)
Conversely, let (p − 1)! ≡ −1(mod p). Assume that p is not prime. Then p has a
divisor d, 1 < d < p, and d divides (p − 1)!. But then d has to divide −1, which
is a contradiction.
Proof. Let p be prime and let p ∤ a, take the first p − 1 positive multiples of a,
i.e.
a, 2a, 3a, ... , (p − 1)a (6.1)
None of these numbers is congruent modulo p to any other, nor is any congruent
to zero.
Indeed, if it happened so, ra ≡ sa(mod p), 1 ≤ r < s < p. Then r ≡ s(mod p),
i.e. p|r − s which is impossible, since r, s < p. Thus, the set of multiples in (6.1)
must be congruent modulo p to 1, 2, ... , p − 1 and also
a · 2a · ... · (p − 1)a ≡ 1 · 2 · ... · (p − 1)(mod p).
Whence ap−1 (p − 1)! ≡ (p − 1)!(mod p) or ap−1 ≡ 1(mod p).
Number Theory Lecture Notes 39
NB. Fermat’s Theorem, in the least, can be a ‘labour saving device’ in certain
calculations.
For example, if n = 117 and a = 2. We see that 2117 = (27 )16 · 25 . Check that
2117 ≡ 44(mod 117). Thus, 2117 ̸≡ 2(mod 117).
So n = 117 is not prime, actually it is a composite since 117 = 13 · 9.
Illustration.
Take 2340 ≡ 1(mod 341) or 2341 ≡ 2(mod 341). Here 341 = 11 · 31, product of
primes.
For 211 ≡ 2(mod 31). Since 211 = (25 )2 · 2 = 2(322 ) ≡ 2(mod 31). While for
2 ≡ 2(mod 11). 231 = (25 )6 · 2 ≡ (−1)6 · 2 ≡ 2(mod 11). Therefore, by the
31
Remark 6.9. It may be of some interest to know that 2n ≡ 2(mod n) for n < 340,
implying that n is prime. This led the Chinese to believe that n is prime if and
only if 2n ≡ 2(mod n) or n|2n − 2.
There are infinitely many pseudoprimes, the smallest four being 341, 561, 645
and 1105.
40 Abubakar Mwasa
2Mn −1 − 1 = 2kn − 1
= (2n − 1)(2n(k−1) + 22n(k−2) + ... + 2n + 1)
= Mn (2n(k−1) + 22n(k−2) + ... + 2n + 1)
≡ 0(mod Mn )
Remark 6.12. There exist composite numbers n that are pseudoprimes to every
base a, i.e. an−1 ≡ 1(mod n) for all integers a with (a, n) = 1. The least being
561. They are called absolute pseudo primes or Carmicheal numbers (1910).
Carmicheal indicated such numbers, including 561 = 3 · 11 · 17, 1105 = 5 · 13 · 17,
2821 = 7 · 13 · 31, 15841 = 7 · 31 · 73.
For instance, 561 = 3 · 11 · 17. Notice that (a, 561) = 1 gives (a, 3) = (a, 11) =
(a, 17) = 1. Applying Theorem 6.4,
and in turn
Proof. (a) If n = p is prime, then all integers {1, 2, ... , p − 1} are relatively
prime to p. Hence, φ(p) = p − 1.
(b) There are pn elements in {1, 2, ... , pn }. An element of this set is not rela-
tively prime to p if and only if it is divisible by p. And the only elements
in the set which are divisible by p are
1 · p, 2 · p, ... , pn−1 · p
Observe that the last element in the set is pn−1 · p = pn . Thus, there are
pn−1 elements where are divisible by p. Hence, there are pn − pn−1 elements
of the set which are relatively prime to p.
(c) Recall that (a, n) = 1 if and only if ax ≡ 1(mod n) for some x. Implying
that (a, n) = 1 if and only if a is invertible modulo n. Now φ(n) is the
number of elements in {1, 2, ... , n − 1} which are relatively prime to n.
Thus, φ(n) is also invertible modulo n.
Theorem 6.19. If the integer n > 1 has prime factorization n = pk11 pk22 ... pkr r ,
then
(i) |S| = m,
Lemma 6.25. Let {r1 , r2 , ... , rk } be a reduced residue system modulo m, where
k = φ(m). Let (a, m) = 1. Then {ar1 , ar2 , ... , ark } is also a reduced residue
system modulo m.
Proof. Let r1 , r2 , ... , rφ(m) be a reduced residue system modulo m. By Lemma 6.25,
ar1 , ar2 , ... , arφ(m) is also a reduced residue system modulo m. Thus,
Example 7.2. (a) Let n = 12, positive divisors of 12 are 1, 2, 3, 4, 6, 12. Then
τ (12) = 6 and σ(12) = 1 + 2 + 3 + 4 + 6 + 12 = 28.
(b) Let n = 5, then τ (5) = 2 and σ(5) = 1 + 5 = 6.
If n = 10; X
τ (10) = 1=1+1+1+1=4
d|10
Solution. Let [D(f )](n) is the sum of the squares of the divisors of n.
X
[D(f )](12) = d2 = 12 + 22 + 32 + 42 + 62 + 122 = 210.
d|12
Theorem 7.4. If n = pk11 pk22 ... pkr r is the prime factorization of n > 1, then the
positive divisors of n are precisely those integers d of the form d = pa11 pa22 ... par r
where 0 ≤ ai ≤ ki , i = 1, 2, ... , r.
are two prime factorizations of the positive integer n. By uniqueness, each prime
qi must be one of the pj and rearranging
Conversely, every number d = pa11 pa22 ... par r , 0 ≤ ai ≤ ki turns out to be the
divisor of n i.e.
n = pk11 pk22 ... pkr r = (pa11 pa22 ... par r )(pk11 −a1 pk22 −a2 ... pkr r −ar )
with d′ = pk11 −a1 p2k2 −a2 ... prkr −ar and ki − ai ≥ 0 for each i. Then d′ > 0 and
d|n.
Theorem 7.5. If n = pk11 pk22 ... pkr r is the prime factorization of n > 1, then
(a) τ (n) = (k1 + 1)(k2 + 1) ... (kr + 1)
pk11 +1 − 1 pk22 +1 − 1 pkr +1 − 1
(b) σ(n) = · · ... · r .
p1 − 1 p2 − 1 pr − 1
Proof. skipped
23 − 1 33 − 1 52 − 1
σ(180) = · · = 7 · 13 · 6 = 546.
2−1 3−1 5−1
Example 7.7. The number n = 7056 = 24 ·32 ·72 has τ (n) = (4+1)(2+1)(2+1) =
45 and
25 − 1 33 − 1 73 − 1
σ(n) = · · = (31 · 26 · 342)/12 = 204321
2−1 3−1 7−1
We remark here that divisor function τ isYthe product of the positive divisors
of an integer n > 1 equal to nτ (n)/2 , that is d = nτ (n)/2 . For instance,
d|n
Y
d = 16τ (16)/2 = 165/2 = 45 = 1024.
d|16
For instance,
X
F (24) = F (8 · 3) = f (d)
d|24
Exercise 7.11. (a) Evaluate τ (n) and σ(n) for n = 987, n = 36000.
8. Primitive Roots
Recall from Euler’s theorem that if (a, m) = 1, then aφ(m) ≡ 1(mod m). Then,
there exist positive integer h such that ah ≡ (mod m). The least such integer h is
called exponent or order of a(mod m), i.e. ah ≡ 1(mod m), then h is an exponent
of a modulo m.
Number Theory Lecture Notes 47
31 ≡ 3(mod 5),
32 ≡ 4(mod 5),
33 ≡ 2(mod 5),
34 ≡ 1(mod 5).
Note that if an integer has order h modulo m, we say that a has order
h(mod m).
Theorem 8.2. Let a be an integer having order h modulo m, the the following
hold.
(i) (a, m) = 1,
Proof
(i) Let d > 0 be a common divisor of a and m. Then d|a and d|m since
ah ≡ 1(mod m), then
ah ≡ 1 + km for some k ∈ Z
k = hq + r, 0 ≤ r < h,
ak = ahq+r = ahq · ar
(iii) Let a ≡ b(mod m), then ah ≡ bh (mod m). But ah ≡ 1(mod m), implying
that bh ≡ 1(mod m).
48 Abubakar Mwasa
a|i−j| ≡ 1(mod m)
Corollary 8.3. If a has order h modulo m, then the integers a, a2 , ... , ah are
incongruent modulo m.
Theorem 8.4. If the integer a has order h modulo m and k > 0, then ak has
order kd modulo m, where d = (h, k).
If ak is assumed to have order r modulo m, then Theorem 8.2 (ii) above asserts
that r|h1 .
On other hand, because a has order h modulo m, the congruence
Corollary 8.5. Let a have order h modulo m. Then ak also has order h if and
only if (h, k) = 1.
Example 8.6. The following table exhibits the orders modulo 13 of the positive
integers less than 13.
integer 1 2 3 4 5 6 7 8 9 10 11 12
order 1 12 3 6 4 12 12 4 3 6 12 2
Observe that order of 2 Modulo 13 is 12, whereas the orders of 22 and 23 are
12 12
6 and 4, respectively. It is easy to verify that 6 = and 4 = in
(2, 12) (3, 12)
accordance with Theorem 8.4.
Number Theory Lecture Notes 49
The integers that also have order 12 modulo 13 are powers 2k for which
(k, 12) = 1. Namely,
21 ≡ 2, 25 ≡ 6, 27 ≡ 11, 211 ≡ 7(mod 13)
If an integer a has the largest order possible, then this is called a primitive root
of m.
Definition 8.7. If (a, m) = 1 and a is of order φ(m) modulo m, then a is a
primitive root of the integer m.
Note that 1m ≡ 1 for all integers m, hence 1 can never be a primitive root of
any integer greater than 2.
Example 8.8. List the primitive roots modulo 6.
Solution. Note that φ(6) = 2. Any integer(mod 6) is congruent to one of
0, 1, 2, 3, 4, 5. Thus, primitive roots modulo 6 will be among 2, 3, 4, 5. But then
22 ≡ 4(mod 6)
32 ≡ 3(mod 6)
42 ≡ 4(mod 6)
52 ≡ 1(mod 6)
Thus, 5 is the only primitive root modulo 6.
Example 8.9. List the primitive roots modulo 7.
Solution. Note that φ(7) = 6. Thus, the primitive roots (mod 7) are among
2, 3, 4, 5, 6.
Observe that 22 ≡ 4(mod 7), 23 ≡ 1(mod 7) from which we have that 26 ≡
4(mod 7). So, 2 is not a primitive root (mod 7).
Also 32 ≡ 2(mod 7), 34 ≡ 4(mod 7), then 36 ≡ 1(mod 7). So 3 is a primitive
root (mod 7).
As 42 ≡ 2(mod 7) and 43 ≡ 1(mod 7). The number 4 cannot be a primitive
root(mod 7). Also,
52 ≡ 4(mod 7)
54 ≡ 2(mod 7)
56 ≡ 1(mod 7)
53 ≡ 6(mod 7)
55 ≡ 3(mod 7)
so, 5 is also a primitive root (mod 7). Finally, 62 ≡ 1(mod 7), so 6 cannot be a
primitive root mod 7. Hence, 3 and 5 are the only primitive roots (mod 7).
Exercise 8.10. (a) List all primitive roots modulo 10.
(b) Show that there are no primitive roots modulo 8
(c) Find the order of the integer (i) 2 modulo 17, (ii) 5 modulo 23.
50 Abubakar Mwasa
Example 9.3. The table below shows the relationship between Mersenne prime
and perfect numbers.
Definition 9.4. A positive integer n > 0 is abundant is σ(n) > 2n and is deficient
if σ(n) < 2n.
It is not known whether there are infinitely many perfect numbers or there
are any odd perfect numbers? So far, all the perfect numbers known are even.
Theorem 9.6. [Euler]. Let n > 0 be a positive integer. Then n is an even perfect
number if and only if n = 2p−1 (2p − 1) for a prime p and 2p − 1 prime.
The proof for this result is delayed. Example, see the table above.
Number Theory Lecture Notes 51
(2a − 1, 2b − 1) = 2(a,b) − 1
Solution.
(a) Note that 52 ≡ 8(mod 17). Thus, 8 is a quadratic residue modulo 17.
(b) Reduced residue system modulo 18 = {1, 5, 7, 11, 13, 17}. Computing their
squares modulo 18
x 1 5 7 11 13 17
2
x (mod 18) 1 7 13 13 7 1
The quadratic residues are squares i.e. 1, 7, 13. Since x2 = (−x)2 , this
explains why row 2 in the table is symmetric left-to-right.
Nn = 1! + 2! + ... + n! is a square.
Nn ≡ 1! + 2! + 3! + 4! ≡ 33 ≡ 3(mod 5)
Lemma 10.5. Let p be an odd prime and consider the congruence x2 ≡ a(mod p),
(a) the only solution is x = 0 or if a = 0.
(b) there are exactly 0 or 2 solutions if p ∤ a.
Example 10.6. The congruence x2 ≡ 8(mod 17) has 5 and 12 as solutions and
5 ≡ −12(mod). On other hand, quadratic residues modulo 17 are {1, 2, 4, 8, 9, 13, 15, 16}.
Thus, x2 ≡ 5(mod 17) has no solutions.
NB. The result is false if p = 2, since x2 ≡ 1(mod 2) has exactly one solution
x ≡ 1(mod 2).
Theorem 10.7. Let p be an odd prime number. A reduced residue system modulo
p consists of p−1
2
quadratic residues and p−1
2
quadratic nonresidues.
Definition 10.8. Let p be an odd prime and let (a, p) = 1. The Legendre symbol,
a
p
is defined by
(
a 1, if a is a quadratic residue mod p
=
p −1, if a is a quadratic nonresidue mod p.
Number Theory Lecture Notes 53
Theorem 10.9. [Euler’s criterion]. For any integer a and any odd prime number
p, we have
a p−1
≡ a 2 (mod p).
p
“These notes are still under development, any suggestions are highly welcome.”
References
1. Sloane, N. J. A. (ed.), “Sequence A007508 (Number of twin prime pairs
below 10n )”, The On-Line Encyclopedia of Integer Sequences. OEIS Foun-
dation. Retrieved 2019-11-01. 15
2. David M. Burton, Elementary Number Theory, 7th ed., Tata McMraw-Hill
Pub. Company LtD, New Delhi, India, 2011.
3. Malik S.B, Basic Number Theory, 2nd ed., Vikas Publishing House, New
Delhi, India, 2009.
4. Hardy, G.H. and Wright, E.M, An Introduction to the Theory of Num-
bers, 5th Edition, Oxford University Press, 1979.
5. James J. Tattersall, Elementary Number Theory in Nine Chapters,
Cambridge University Press, 1999.
54 Abubakar Mwasa