GOVERNMENT COLLEGE OF ENGINEERING AND
TEXTILE TECHNOLOGY,SERAMPORE
• NAME OF THE TOPIC :- Euclid’s Algorithm
• Continuous Assessment 1 (CA1): Technical Presentation
• NAME:- PRADEEP SHAW
• UNIVERSITY ROLL NO.: 11000223022
• REGISTRATION NO: 231100110112
• STREAM :- INFORMATION TECHNOLOGY
• SUBJECT NAME:-Discrete Mathematics
• SUBJECT CODE: PCC-CS401
• ACADEMIC YEAR :- 2024-25
• RESPONSIBLE TEACHER:- SUMAN CHATTARJEE
CONCEPT OF GCD OF TWO NUMBERS
The Greatest Common Divisor(GCD) of two integers is defined as
follows:
An integer c is called the GCD(a,b) (read as the greatest
common divisor of integers a and b) if the following 2
conditions hold:
1) c | a & c | b
2) For any common divisor d of a and b, d | c.
Note :- Ensures that the divisor c is the greatest of all the
common divisors of a and b.
TO FIND GCD OF TWO NUMBERS
• To find DCD of two integers a &b i.e, GCD(a,b) , one way is that we
could prime factorize each integer, and from the prime
factorization, see which factors are common between the two
integers.
• Example :-
12 = 2×2×3 & 28 = 2×2×7
So , GCD(28,12) = 2×2 = 4.
However, this method become very time consuming as soon as the
integers are relatively large.
Euclid’s Algorithm to find GCD of two integers
• Euclid devised a fairly simple and efficient algorithm to determine the
GCD of two integers. The algorithm basically makes use of the division
algorithm repeatedly.
Let’s say you are trying to find the GCD(a,b), where a and b are integers
with a > 0 , b > 0
• Euclid’s algorithm says to write out the following:
a = q 1b + r1, where 0 < r < b
b = q 2 r1 + r 2 , where 0 < r2 < r1
r1 = q 3 r2 + r 3 , where 0 < r3 < r2
ri = qi+2ri+1+ ri+2, where 0 < ri+2 < ri+1
rk-1 = qk+1rk .
Then , Euclid’s algorithm says that the GCD(a,b) = r k
Let me take an example to explain well
• Consider computing GCD(125, 87)
• 125 = 1×87 + 38
» 87 = 2×38 + 11
» 38 = 3×11 + 5
» 11 = 2×5 + 1
» 5 = 5×1
Thus, we find that GCD(125,87) = 1.
Example no. 2
• Let’s look one more example , GCD(125, 20)
125 = 6*20 + 5
20 = 4*5,
Thus, the GCD(125,20) = 5.
Example no. 3
• Let’s find the GCD(980,78)
980 = 78 × 12 + 44
78 = 44 × 1 + 34
44 = 34 × 1 + 10
34 = 10 × 3 + 4
10 = 4 × 2 + 2
4=2×2+0
We can conclude that the GCD of 980 and 78 is 2.
Conclusion
• Euclid’s algorithm is a highly efficient and fundamental method
for computing the Greatest Common Divisor (GCD) of large
integers. Its recursive and iterative approaches ensure fast
computations, even for very large numbers, making it widely
used in modern applications such as cryptography, number
theory, and computer science. The algorithm's simplicity and
effectiveness highlight the power of mathematical reasoning in
problem-solving, demonstrating how ancient mathematical
principles continue to play a crucial role in contemporary
computational techniques.
References
• I made this PPT using
1 . Class notes (Taught by Suman Chatterjee Sir)
2. https://www.scribd.com/document/82275860/Euclid
3. Discrete Mathematics vol-4 (Author:- Pal & Das ).