0% found this document useful (0 votes)
5 views11 pages

ds activity

The document is a mini project report on the Euclidean Algorithm, submitted by Vishwanath V for a Data Security course at Visvesvaraya Technological University. It details the algorithm's methodology for finding the greatest common divisor (GCD) of two integers, including its historical background, implementation in MATLAB, and a flow chart representation. The report also includes results from a sample execution and references for further reading.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views11 pages

ds activity

The document is a mini project report on the Euclidean Algorithm, submitted by Vishwanath V for a Data Security course at Visvesvaraya Technological University. It details the algorithm's methodology for finding the greatest common divisor (GCD) of two integers, including its historical background, implementation in MATLAB, and a flow chart representation. The report also includes results from a sample execution and references for further reading.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

VISVESVARAYA TECHNOLOGICAL

UNIVERSITY
Jnana Sangama, Belgavi-590018

MINI PROJECT REPORT


FOR
COURSE: DATA SECURITY
COURSE CODE: BEC613B

Title: Euclidean Algorithm

Submitted by
NAME: Vishwanath V
USN: 1KS22EC121

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING


K.S. INSTITUTE OF TECHNOLOGY, BENGALURU-560109
2024-25
K.S. INSTITUTE OF TECHNOLOGY
No14, Raghuvanahalli, Kanakapura Road, Bangalore-560109

DEPARTMENT OF ELECTRONICS AND COMMUNICATIONENGINNEERING

CERTIFICATE

This is to certify that Mr.Vishwanath.V bearing

USN:1KS22EC121 are bonafide students of Electronics &

Communication Engineering department, KSIT affiliated to

Visvesvaraya Technological University, Belagavi. It is certified that all

suggestions indicated for MINI PROJECT: Euclidean Algorithm have

been incorporated in the report

Name & Signature Signature of HOD


of the course-in-charge
Dr. Saleem S Tevaramani
Assistant Professor, Dept. of ECE KSIT
TABLE OF CONTENTS
CHAPTER TITLE PAGE NO.

1. Abstract 1

2. Introduction to algorithm 2

3. Methodology 3

4. Code 4

5. Flow Chart 6

6. Results 7

7. References 7
1. ABSTRACT

The Euclidean Algorithm is a classical method for finding the greatest


common divisor (GCD) of two integers. It is based on the principle that the
GCD of two numbers also divides their difference. This algorithm is one
of the oldest known, originating from Euclid’s Elements around 300 BCE.
It operates through a series of divisions, replacing the larger number with
the remainder of the division of the two numbers. The process is repeated
until the remainder becomes zero. The last non-zero remainder is the GCD
of the original pair of numbers. The Euclidean Algorithm is efficient and
can handle very large integers. It has a time complexity of
O(log(min(a,b))), making it suitable for applications in number theory and
cryptography. A common application is in simplifying fractions and
modular arithmetic. The algorithm can be implemented using either
recursion or iteration. It also forms the basis for the Extended Euclidean
Algorithm, which computes coefficients for Bézout’s identity. These
coefficients are useful in solving linear Diophantine equations. The method
has been adapted for polynomials and other mathematical structures. Its
simplicity and effectiveness make it a fundamental tool in computer
science and mathematics. Even with modern computational methods, the
Euclidean Algorithm remains a cornerstone for algorithm
design and analysis.

1
2: Introduction to Euclidean Algorithm

The Euclidean Algorithm is a fundamental mathematical technique used to


compute the greatest common divisor (GCD) of two integers. It is named after
the ancient Greek mathematician Euclid, who first described it in his work
Elements around 300 BCE. The GCD is the largest number that evenly divides
two given numbers without leaving a remainder. Finding the GCD is essential
in many areas of mathematics, such as number theory, algebra, and
cryptography. The Euclidean Algorithm is based on a simple idea: the GCD
of two numbers also divides their difference. This allows the problem to be
reduced step by step through division. In each step, the larger number is
divided by the smaller number, and the remainder is used as the new smaller
number. The process continues until the remainder is zero. The last non-zero
remainder is the GCD. This algorithm is both efficient and easy to implement,
making it popular in both theoretical and applied mathematics. It works not
only for small numbers but also for very large ones, which is useful in
computer science and encryption. The algorithm can be expressed in iterative
or recursive form. It also forms the basis for the Extended Euclidean
Algorithm, which provides additional solutions. The simplicity of the
Euclidean Algorithm lies in its repeated use of division and subtraction.
Despite being over two thousand years old, it is still taught and widely used
today. Its enduring relevance demonstrates the power of logical, systematic
problem-solving in mathematics.

2
3: Methodology

1.Consider any two number (a,b) the highest number of (a,b) will be considered
as dividend, the least number of (a,b) considered as divisor.
2.Divide the given number and find the quotient and remainder.
3.if R=0 stop the division and GCD for the given number will be divisor such
as b.
4.if R=0 continue the division considering the previous divisor value as
dividend and previous remainder as divisor continue the procedure until the
R=0.

3
4: Code

clc;
close all;
clear all;
N1 = input('Enter the first number: ');
N2 = input('Enter the second number: ');
N3 = abs(N1);
N4 = abs(N2);
if (N3 > N4)
a = N3;
b = N4;
else
a = N4;
b = N3;
end
GCD = gcd(a, b);
fprintf('The GCD of %d and %d is %d\n', N1, N2, GCD);

4
Explanation of the code:
1.Start fresh:
The first three lines clear old stuff to the program starts clean
2.Ask the user for two numbers:
The program asks you to enter two numbers(they can be positive or
negative).
3.Make both numbers positive:
It changes both numbers to positive, because GCD works with
positive values.
4.Find which number is bigger:
It checks which number is larger and stores them as a(bigger one)
and b(smaller one).
5.Find the GCD:
It uses MATLAB’s built-in gcd function to find the greatest number
that divides both a and b exactly.
6.Show the result:
It prints the GCD of the original two numbers you entered.

5
5: Flow Chart

Start

Input two positive integer


a and b

a divides b

No
Consider previous b value as
If r=0
a and previous r value as b

Yes

GCD=b

Stop

6
6: Results
Enter the first number: 156
Enter the second number: -5
The GCD of 156 and -5 is 1

7: References:
1.Stallings, w. Cryptography and Network Security: Principles and Practice (6th Edition)
2.Matrixlab-Examples (n.d.). Euclidean Algorithm with matlab
3. X. Zhu, X. Wu, W. Ben, and H. Zhou, "An Improved Fuzzy C-Means Clustering
Algorithm Using Euclidean Distance Function," Journal of Intelligent & Fuzzy
Systems, 2023, doi: 10.3233/JIFS-223576.
4. B. Hopkins and A. Tangboonduangjit, "Ties in Worst-Case Analysis of the Euclidean
Algorithm," Mathematical Communications, 2021, ISSN: 1331-0623.

You might also like