Number Theory
Number Theory
UNIT-I
NUMBER THEORY
Topic Learning Objectives:
Introduction
Number theory is the study of natural or counting numbers, including prime numbers.
Number theory is important because the simple sequence of counting numbers from one to
infinity conceals many relationships beneath its surface.
Number theory is an immensely rich area and it is defined by the important problems that it
tries to solve. Sometimes a problem was considered solved, but years later the solution was
found to be flawed. One important challenge in number theory has been trying to find a
formula that will describe all the prime numbers. To date, that problem has not been solved.
One of Gauss's most important contributions to number theory involved the invention of the
idea of congruence in numbers and the use of what he called "modulo" or small measures
or sets of numbers. In effect, his theory of congruence allows people to break up the infinite
series of whole numbers into smaller, more manageable chunks of numbers and perform
computations upon them. This arrangement makes the everyday arithmetic involved in such
things as telling time much easier to program into computers.
Prime and composite numbers play an important role in modern cryptography or coding
systems. Huge volumes of confidential and large amounts of money are transferred
electronically around the world every day, all of which must kept secret. One of the
important applications of number theory is keeping secrets.
This time gap between finding out if a number is prime and factoring the primes in a
composite number is useful to cryptographers. To create a security system, they invent
numerical codes for the letters and characters of a message.
Number theory: a huge, ancient, complex, and above all, beautiful branch of mathematics.
Historically, number theory was known as the Queen of Mathematics and was very much a
branch of pure mathematics, studied for its own sake instead of understanding real world
applications. This has changed in recent years however, as applications of number theory
have been unearthed. Probably the most well-known example of this is RSA cryptography,
one of the methods used in encrypting data on the internet. It is number theory that makes
this possible.
Divisibility
If 𝑎 and 𝑏 are integers such that 𝑎 ≠ 0, then we say “𝑎 divides 𝑏” if there exists an integer
𝑘 such that 𝑏 = 𝑘𝑎.
Note that any even integer has the form 2𝑘 for some integer 𝑘, while any odd integer has
the form 2𝑘 + 1 for some integer 𝑘. Thus 2|𝑛 if 𝑛 is even, while 2 ⫮ 𝑛 if 𝑛 is odd.
Elementary properties:
1. If 𝑎 is any non-zero integer, then 𝑎|𝑎 and 𝑎|0.
Properties:
(1) If a and b are non-zero integers such that 𝑎|𝑏 and 𝑏|𝑎, then 𝑎 = ±𝑏.
𝑏𝑎 = (𝑘1 𝑘2 )𝑎𝑏
⇒ 𝑘1 𝑘2 = 1
Thus 𝑎 = 𝑏 or 𝑎 = −𝑏
∴ 𝑎 = ±𝑏
⇒ 𝑐 = 𝑘3 𝑎 where 𝑘3 = 𝑘1 𝑘2 ∈ 𝑍
∴ 𝑎|𝑐.
(3) If 𝑎|𝑏 and 𝑎|𝑐 then (i) 𝑎|𝑏 + 𝑐 (ii) 𝑎|𝑏 − 𝑐 (iii) 𝑎|𝑏𝑐
∴ 𝑎|𝑏 + 𝑐
∴ 𝑎|𝑏 − 𝑐
∴ 𝑎|𝑏𝑐
𝑏𝑥 = 𝑘𝑎𝑥 = (𝑘𝑥)𝑎
∴ 𝑎|𝑏𝑥
𝑏𝑑 = 𝑘3 𝑎𝑐 where 𝑘3 = 𝑘1 𝑘2 ∈ 𝑍
∴ 𝑎𝑐|𝑏𝑑.
On dividing by 𝑐,
𝑏 = 𝑘𝑎 where 𝑘 ∈ 𝑍
∴ 𝑎|𝑏.
Division algorithm
The division algorithm, despite its name, it is not really an algorithm. It states that when
you divide two numbers, there is a unique quotient and remainder. Specifically, it says the
following:
Theorem: Let 𝑎, 𝑏 ∈ 𝑍 with 𝑏 > 0. Then there exist unique 𝑞, 𝑟 ∈ 𝑍 such that 𝑎 = 𝑏𝑞 +
𝑟 and 0 ≤ 𝑟 < 𝑏.
The integers 𝑞 and 𝑟 are called the quotient and remainder respectively.
For example, if 𝑎 = 27 and 𝑏 = 7, then 𝑞 = 3 and 𝑟 = 6. That is, 27 ÷ 7 is 3 with a
remainder of 6, or in equation form: 27 = 7 × 3 + 6.
Definition: The greatest common divisor of two integers 𝑎 and 𝑏 is the greatest integer
that divides both 𝑎 and 𝑏.
We denote the greatest common divisor of two integers 𝑎 and 𝑏 by 𝑔𝑐𝑑(𝑎, 𝑏) or (𝑎, 𝑏).
Example: Note that the greatest common divisor of 24 and 18 is 6. In other words
𝑔𝑐𝑑(24, 18) = 6.
There are integers (e.g. 3 and 4, etc.) whose greatest common divisor is 1 so we call such
integers relatively prime integers.
Example: The greatest common divisor of 9 and 16 is 1, thus they are relatively prime.
Note that every integer has positive and negative divisors. If 𝑎 is a positive divisor of 𝑚,
then −𝑎 is also a divisor of 𝑚 . Therefore, by our definition of the greatest common
divisor, we can see that 𝑔𝑐𝑑(𝑎, 𝑏) = 𝑔𝑐𝑑(| 𝑎 |, | 𝑏 |).
We now present a theorem about the greatest common divisor of two integers. The theorem
states that if we divide two integers by their greatest common divisor, then the outcome is a
couple of integers that are relatively prime.
NOTE:
1. If ′𝑎′ is a non-zero integer, then 𝑔𝑐𝑑(𝑎, 0) = 𝑎.
𝑎 𝑏
2. If 𝑔𝑐𝑑(𝑎, 𝑏) = 𝑑 then 𝑔𝑐𝑑 (𝑑 , 𝑑) = 1
Continuing this process of dividing each divisor by the next remainder, at some stage 0
remainder is obtained. The last non zero remainder is the GCD of 𝑎 and 𝑏. This is known as
Euclid’s algorithm method.
Now to express the GCD as 𝑎𝑥 + 𝑏𝑦, the successive divisors are as follows
𝑎) 𝑏 (𝑞
𝑞𝑎
________ 𝑟1 = 𝑏 − 𝑞𝑎 (1)
𝑏 − 𝑞𝑎 = 𝑟1
𝑟1 ) 𝑎(𝑞1
𝑞1 𝑟1
___________ 𝑟2 = 𝑎 − 𝑞1 𝑟1 (2)
𝑎 − 𝑞1 𝑟1 =𝑟2
𝑟2 ) 𝑟1 (𝑞2
𝑞2 𝑟2
___________ 𝑟3 = 𝑟1 − 𝑞2 𝑟2 (3)
𝑟1 − 𝑞2 𝑟2=𝑟3
The process is continued till the remainder is 0. Similarly, the following equations are
obtained.
𝑟4 = 𝑟2 − 𝑞3 𝑟3 (3)
⋮
⋮
𝑟𝑛−2 = 𝑟𝑛−4 − 𝑞𝑛−3 𝑟𝑛−3
𝑟𝑛−1 = 𝑟𝑛−3 − 𝑞𝑛−2 𝑟𝑛−2
𝑟𝑛 = 𝑟𝑛−2 − 𝑞𝑛−1 𝑟𝑛−1
Next remainder 𝑟𝑛+1 becomes 0.
∴ GCD of 𝑎 and 𝑏 is 𝑟𝑛 .
609 = 551 × 1 + 58
551 = 58 × 9 + 29
58 = 29 × 2
Hence (4147,10672) = 29
We now use the steps in the Euclidean algorithm to write the greatest common divisor of
two integers as a linear combination of the two integers. The following example will
determine the variables 𝑚 and 𝑛. The following algorithm can be described by a general
form but for the sake of simplicity of expressions we will present an example that shows
the steps for obtaining the greatest common divisor of two integers as a linear combination
of the two integers.
Example: Express 29 as a linear combination of 4147 and 10672:
Solution: 29 = 551 − 9 × 58
29 = 551 − 9(609 − 551 × 1)
= (10 × 551) − (9 × 609)
= 10 × (1769 − 609 × 2) − 9 × 609
= 10 × 1769 − (29 × 609)
= 10 × 1769 − 29(2378 − 1769)
= 39 × 1769 − (29 × 2378)
= 39 × (4147 − 2378 × 1) − 29
= 39 × 4147 − (68 × 2378)
= 39 × 4147 − 68(10672 − 4147)
29 = 175 × 4147 − (68 × 10672)
As a result, we see that 29 = 175 × 4147 − 68 × 10672.
Exercises:
1. By using the Euclidean algorithm, find the greatest common divisor 𝑑 of 1769 and 2378
and then find integers 𝑥 and 𝑦 to satisfy 1769𝑥 + 2378𝑦 = 𝑑. Also show that 𝑥 and 𝑦 are
not unique.
2. By using the Euclidean algorithm, find the greatest common divisor 𝑑 of 2689 and 4001
and then find integers 𝑥 and 𝑦 to satisfy 2689𝑥 + 4001𝑦 = 𝑑. Also show that 𝑥 and 𝑦 are
not unique.
3. Find the greatest common divisor 𝑑 of the numbers 1819 and 3587 using Euclid’s
algorithm and then find integers 𝑥 and 𝑦 to satisfy 1819𝑥 + 3587𝑦 = 𝑑.
Answers:
1. 𝐺𝐶𝐷(1769,2378) = 29 and 29 = 1769𝑥 + 2378𝑦 where 𝑥 = 39 and 𝑦 = −29
Prime Numbers
Prime numbers, the building blocks of integers, have been studied extensively over the
centuries. Being able to present an integer uniquely as product of primes is the main reason
behind the whole theory of numbers and behind the interesting results in this theory. Many
interesting theorems, applications and conjectures have been formulated based on the
properties of prime numbers.
Definition: A prime is an integer greater than 1 that is only divisible by 1 and itself.
Example: Find the number and sum of all positive divisors of 960.
Solution: 960 = 26 × 3 × 5
∴ 𝑝1 = 2, 𝑝2 = 3, 𝑝3 = 5, 𝑎1 = 6, 𝑎2 = 1, 𝑎3 = 1
𝜏(960) = (1 + 𝑎1 )(1 + 𝑎2 )(1 + 𝑎3 )
𝜏(960) = (1 + 6)(1 + 1)(1 + 1)=28.
𝑎 +1 𝑎 +1 𝑎 +1
𝑝1 1 − 1 𝑝2 2 − 1 𝑝𝑛 3 − 1
𝜎(960) = ( )( )( )
𝑝1 − 1 𝑝2 − 1 𝑝3 − 1
26+1 − 1 36+1 − 1 56+1 − 1
𝜎(960) = ( )( )( )
2−1 3−1 5−1
𝜎(960) = (127)(4)(6) = 3048
Exercises
1. Find the number of positive divisors and sum of all positive divisors of 1363.
2. Find the number of positive divisors and sum of all positive divisors of 8128.
3. Check whether 853 is a prime number or not?
4. Prove that there are infinitely many primes.
5. If p is a prime number and 𝑝|𝑎𝑏 where 𝑎 and 𝑏 are any integers, then prove that either
p|𝑎 or 𝑝|𝑏.
Answers:
1. Number of divisors = 4
Sum of divisors = 1440
2. Number of divisors = 14
Sum of divisors = 16256
3. 853 is a prime number.
Example: 99 = 3 × 3 × 11 = 32 × 11,
32 = 2 × 2 × 2 × 2 × 2 = 25 .
Congruences
Congruence is nothing more than a statement about divisibility. The theory of congruences
was introduced by Carl Friedrich Gauss. Gauss contributed to the basic ideas of
congruences and proved several theorems related to this theory. We start by introducing
congruences and their properties.
Exercises
1. Determine the remainder when 53103 + 10353 is divisible by 39.
2. Find the remainder obtained when 135 × 74 × 48 is divided by 7
3. What is the remainder in the division of 250 by 7
Answers
1. 0
2. 6
3. 4
Linear congruence:
A congruence of the form 𝑎𝑥 ≡ 𝑏(𝑚𝑜𝑑 𝑚), where 𝑥 is an unknown integer, is called a
linear congruence in one variable.
(ii) If (𝑎, 𝑚) = 𝑑 and 𝑑|𝑏 then the above congruence has 𝑑 incongruent solutions
4𝑥 ≡ 5(𝑚𝑜𝑑 12)
⇒ 12|4𝑥 − 5
⇒ 4𝑥 − 5 = 12𝑘
12𝑘 + 5
⇒𝑥=
4
5
⇒ 𝑥 = 3𝑘 + 4, where 𝑘 ∈ 𝑍
𝑥 ≡ 0(𝑚𝑜𝑑 3)
𝑥 ≡ 1(𝑚𝑜𝑑 3)
𝑥 ≡ 2(𝑚𝑜𝑑 3)
7𝑥 ≡ 9(𝑚𝑜𝑑 15)
⇒ 15|7𝑥 − 9
⇒ 7𝑥 − 9 = 15𝑘
15𝑘+9
⇒𝑥= 7
, where 𝑘 ∈ 𝑍
∴ 𝑥 ≡ 12(𝑚𝑜𝑑 15)
Exercises
1. Examine if the linear congruence 7𝑥 ≡ 13(𝑚𝑜𝑑 24) has unique solution, and hence
solve it.
Answers
1. 𝑥 ≡ 19(𝑚𝑜𝑑 24), the congruence has unique solution.
2. 𝑥 = 12,19,26
3. 𝑥 ≡ 4(𝑚𝑜𝑑 10), the congruence has unique solution.
Properties
1 1 1
𝜙(𝑛) = 𝑛 (1 − ) (1 − ) ⋯ (1 − )
𝑝1 𝑝2 𝑝𝑟
Example1: 𝜙(5) = 4.
𝜙(360) = 𝜙(23 32 5)
1 1 1
𝜙(360) = 360 (1 − ) (1 − ) (1 − ) = 96
2 3 5
second Semester 14 Number theory (22MA21C)
Department of Mathematics
Euler's Theorem
Euler's theorem states that if (𝑎, 𝑚) = 1, then 𝑎𝜙(𝑚) ≡ 1 (𝑚𝑜𝑑 𝑚).
Solution: We note that 𝑔𝑐𝑑(10, 55) = 5, and hence this pair is not relatively prime,
however, we know that 55 has a prime power decomposition of 55 = 5 × 11.
11𝜙(10) ≡ 1 (𝑚𝑜𝑑 10). We note that 𝜙(10) = 4. Hence 114 ≡ 1 (𝑚𝑜𝑑 10), and more
appropriately 555 = 55 . 115 = 55 . 114 . 11 ≡ 55 . (1)4 . 11 ≡ 34375 ≡ 5 (𝑚𝑜𝑑 10)
Solution: We first note that finding the last two digits 33334444 can be obtained by
reducing 33334444 (𝑚𝑜𝑑 100). Since 𝑔𝑐𝑑(3333, 100) = 1, we can apply Euler’s theorem.
1 1
We first calculate that 𝜙(100) = 𝜙(22 × 52 ) = 100 (1 − 2) (1 − 5) = 40.
4444 = 40(111) + 4
Cryptography
In the age of the internet, when we use the internet to conduct business transactions, check
our bank account, use credit cards to buy things online, and take cash out of an ATM,
security technologies such as armed guards and X-ray machines simply don’t work. The
danger with modern internet transactions is that you must send private data through a public
network in order to reach its destination, such as your bank. The problem with this is that
anyone can intercept read the message you have sent.
4. Choose 𝑒 such that 𝑒 > 1 and coprime to totient which means gcd (𝑒, 𝑡𝑜𝑡𝑖𝑒𝑛𝑡) must be
equal to 1, 𝑒 is the public key
5. Choose 𝑑 such that it satisfies the equation 𝑑𝑒 = 1 + 𝑘(𝑡𝑜𝑡𝑖𝑒𝑛𝑡), 𝑑 is the private key not
known to everyone
6. Cipher text is calculated using the equation 𝑐 = 𝑚𝑒 (𝑚𝑜𝑑 𝑛), where 𝑚 is the message.
7. With the help of 𝑐 and 𝑑 we decrypt message using the equation 𝑚 = 𝑐 𝑑 (𝑚𝑜𝑑 𝑛), where
𝑑 is the private key.
2. 𝑛 = 𝑝𝑞 = 11 × 3 = 33
3. Choose 𝑒 = 3.
𝑔𝑐𝑑(𝑒, 𝑞 − 1) = 𝑔𝑐𝑑(3, 2) = 1
This is actually the smallest possible value for the modulus 𝑛 for which the RSA algorithm
works.
Exercises
1. Given the public key (𝑒, 𝑛) = (7,55), encrypt plain text PLAN, where the alphabets
𝐴, 𝐵, 𝐶, … 𝑋, 𝑌, 𝑍 are assigned the numbers 2,3, ⋯ ,26,27. Give the cipher text. Find the
private key 𝑑.
2. Given the public key (𝑒, 𝑛) = (7,85), encrypt plain text HI, where the alphabets
𝐴, 𝐵, 𝐶, … 𝑋, 𝑌, 𝑍 are assigned the numbers 2,3, ⋯ ,26,27. Give the cipher text. Find the
private key 𝑑.
Answers:
1. Cipher text is GFQD (8,7,18,5) and private key 𝑑 = 23.
2. Cipher text is RD (19, 5) and private key 𝑑 = 55.