SlideShare a Scribd company logo
1 of 16
Introduction to Number Theory
and
Greatest Common Divisor
By Rashila Shrestha
MTech. IT 2021
Kathmandu University
Sept 14, 2022
Outline
❏ Number Theory
❏ Greatest Common Divison (GCD)
❏ Euclidean Algorithm
❏ Solving GCD using method 1 and 2
❏ Applications
2
3
Number Theory
Field of Mathematics consisting of study of properties of whole number.
Integers and their properties
Uses computers in factoring large integers, determining primes, testing conjectures and
solving problems.
Key ideas in number theory include divisibility and primal of integers
4
Division
Definition: If a and b are integers with a ≠ 0, then a divides b if there exists
an integer c such that b = ac.
When a divides b we say that a is a factor or divisor of b and that b is a
multiple of a.
The notation a | b denotes that a divides b.
If a | b, then b/a is an integer.
If a does not divide b, we write a ∤ b.
5
Primes
Definition: A positive integer p greater than 1 is called prime if the only
positive factors of p are 1 and p.
A positive integer that is greater than 1 and is not prime is called
composite.
Example: The integer 7 is prime because its only positive factors are 1
and 7, but 9 is composite because it is divisible by 3.
6
Greatest Common Divisor (GCD)
GCD of two or more integers is the largest positive integer that divides each of the integers.
“A positive integer c is called greatest common divisor of a and b if c divides both a and b”
It is denoted: gcd(a, b)
The greatest common divisor of two positive integers can be found by using their prime
factorizations.
We say that two integers are relatively prime if their greatest common division (gcd) is 1.
7
GCD Examples 1
Find GCD(12, 33)
Numbers Divisors Common Divisor GCD
12 1,2,3,4,6,12 1,3 3
33 1,3,11,33
GCD(12, 33) = 3
8
Euclidean Algorithm
Using Theorem: Given integers a>b, such that b= aq +r, then gcd (b,a) = gcd(a,r)
a and b being the positive integers and q and r being quotient and remainder.
Time Complexity:
0(log(min(a,b)))
9
GCD contd..
Euclid’s Algorithm to calculate GCD in pseudocode:
function gcd(x, y)
while (y ≠ 0)
r = x mod y;
x = y
y = r
return x
10
Finding GCD using Euclid’s Algorithm (Method 1)
Find GCD(12, 33)
q x y r
2 33 12 9
1 12 9 3
3 9 3 0
3 0
GCD(12,33) = 3
11
contd..
Find GCD (750, 900)
q x y r
1 900 750 150
5 750 150 0
150 0
GCD(750,900) =150
12
Finding GCD using Euclid’s Algorithm(Method 2)
By definition:
x=yq+r such that x>y then gcd(x,y) = gcd(y,r)
● 33 = 12 x 2 +9
● 12 = 9 x 1 +3
● 9 = 3 x 3 +0
(since gcd(x,y) = gcd(y, x mod y))
gcd(33,12) = gcd(12,9) = gcd(9,3) =3
Therefore, gcd(12,33) = 3
13
Find GCD(12,33)
Stopping Condition
Applications
Computer Organization and Security
Coding and Cryptography(Encryption Algorithm RSA))
Random Number Generation
Hash Functions and Graphics
14
References
1. Intro to Algorithms: CHAPTER 33: NUMBER-THEORETIC ALGORITHMS (ustc.edu.cn)
2. https://primes.utm.edu/notes/faq/one.html
3. number theory | Definition, Topics, & History | Britannica
15
Thank You
Any Queries??
16

More Related Content

Similar to Number Theory and GCD.pdf

Similar to Number Theory and GCD.pdf (20)

Number theory
Number theoryNumber theory
Number theory
 
number theory.ppt
number theory.pptnumber theory.ppt
number theory.ppt
 
Number theory
Number theoryNumber theory
Number theory
 
GCD.ppt
GCD.pptGCD.ppt
GCD.ppt
 
Cryptography and Network Security Principles and Practice.docx
Cryptography and Network Security Principles and Practice.docxCryptography and Network Security Principles and Practice.docx
Cryptography and Network Security Principles and Practice.docx
 
Chapter 2 Lecture Notes_ Divisibility.pdf
Chapter 2 Lecture Notes_ Divisibility.pdfChapter 2 Lecture Notes_ Divisibility.pdf
Chapter 2 Lecture Notes_ Divisibility.pdf
 
Ch04
Ch04Ch04
Ch04
 
Number theoretic-rsa-chailos-new
Number theoretic-rsa-chailos-newNumber theoretic-rsa-chailos-new
Number theoretic-rsa-chailos-new
 
number theory
number theorynumber theory
number theory
 
Ch4.pdf
Ch4.pdfCh4.pdf
Ch4.pdf
 
GCD of n Numbers
GCD of n NumbersGCD of n Numbers
GCD of n Numbers
 
Chapter1.integer s.y.b.c.s
Chapter1.integer s.y.b.c.sChapter1.integer s.y.b.c.s
Chapter1.integer s.y.b.c.s
 
Lec_2.pdf
Lec_2.pdfLec_2.pdf
Lec_2.pdf
 
integrated algebra.pptx
integrated algebra.pptxintegrated algebra.pptx
integrated algebra.pptx
 
Class8 calculus ii
Class8 calculus iiClass8 calculus ii
Class8 calculus ii
 
new 2.ppt
new 2.pptnew 2.ppt
new 2.ppt
 
Showing is not explaining
Showing is not explainingShowing is not explaining
Showing is not explaining
 
Modular arithmetic
Modular arithmeticModular arithmetic
Modular arithmetic
 
Equivariance
EquivarianceEquivariance
Equivariance
 
Number Theory
Number TheoryNumber Theory
Number Theory
 

Recently uploaded

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 

Recently uploaded (20)

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 

Number Theory and GCD.pdf

  • 1. Introduction to Number Theory and Greatest Common Divisor By Rashila Shrestha MTech. IT 2021 Kathmandu University Sept 14, 2022
  • 2. Outline ❏ Number Theory ❏ Greatest Common Divison (GCD) ❏ Euclidean Algorithm ❏ Solving GCD using method 1 and 2 ❏ Applications 2
  • 3. 3
  • 4. Number Theory Field of Mathematics consisting of study of properties of whole number. Integers and their properties Uses computers in factoring large integers, determining primes, testing conjectures and solving problems. Key ideas in number theory include divisibility and primal of integers 4
  • 5. Division Definition: If a and b are integers with a ≠ 0, then a divides b if there exists an integer c such that b = ac. When a divides b we say that a is a factor or divisor of b and that b is a multiple of a. The notation a | b denotes that a divides b. If a | b, then b/a is an integer. If a does not divide b, we write a ∤ b. 5
  • 6. Primes Definition: A positive integer p greater than 1 is called prime if the only positive factors of p are 1 and p. A positive integer that is greater than 1 and is not prime is called composite. Example: The integer 7 is prime because its only positive factors are 1 and 7, but 9 is composite because it is divisible by 3. 6
  • 7. Greatest Common Divisor (GCD) GCD of two or more integers is the largest positive integer that divides each of the integers. “A positive integer c is called greatest common divisor of a and b if c divides both a and b” It is denoted: gcd(a, b) The greatest common divisor of two positive integers can be found by using their prime factorizations. We say that two integers are relatively prime if their greatest common division (gcd) is 1. 7
  • 8. GCD Examples 1 Find GCD(12, 33) Numbers Divisors Common Divisor GCD 12 1,2,3,4,6,12 1,3 3 33 1,3,11,33 GCD(12, 33) = 3 8
  • 9. Euclidean Algorithm Using Theorem: Given integers a>b, such that b= aq +r, then gcd (b,a) = gcd(a,r) a and b being the positive integers and q and r being quotient and remainder. Time Complexity: 0(log(min(a,b))) 9
  • 10. GCD contd.. Euclid’s Algorithm to calculate GCD in pseudocode: function gcd(x, y) while (y ≠ 0) r = x mod y; x = y y = r return x 10
  • 11. Finding GCD using Euclid’s Algorithm (Method 1) Find GCD(12, 33) q x y r 2 33 12 9 1 12 9 3 3 9 3 0 3 0 GCD(12,33) = 3 11
  • 12. contd.. Find GCD (750, 900) q x y r 1 900 750 150 5 750 150 0 150 0 GCD(750,900) =150 12
  • 13. Finding GCD using Euclid’s Algorithm(Method 2) By definition: x=yq+r such that x>y then gcd(x,y) = gcd(y,r) ● 33 = 12 x 2 +9 ● 12 = 9 x 1 +3 ● 9 = 3 x 3 +0 (since gcd(x,y) = gcd(y, x mod y)) gcd(33,12) = gcd(12,9) = gcd(9,3) =3 Therefore, gcd(12,33) = 3 13 Find GCD(12,33) Stopping Condition
  • 14. Applications Computer Organization and Security Coding and Cryptography(Encryption Algorithm RSA)) Random Number Generation Hash Functions and Graphics 14
  • 15. References 1. Intro to Algorithms: CHAPTER 33: NUMBER-THEORETIC ALGORITHMS (ustc.edu.cn) 2. https://primes.utm.edu/notes/faq/one.html 3. number theory | Definition, Topics, & History | Britannica 15