An open API service indexing awesome lists of open source software.

https://github.com/juliusmarkwei/euclids_algorithm

An algorithm known as the Euclid's Algorithm. This algorithm takes two inputs a and b, positive non-zero integers, and computes the greatest common divisor (GDC) g, of the two integers.
https://github.com/juliusmarkwei/euclids_algorithm

Last synced: 11 months ago
JSON representation

An algorithm known as the Euclid's Algorithm. This algorithm takes two inputs a and b, positive non-zero integers, and computes the greatest common divisor (GDC) g, of the two integers.

Awesome Lists containing this project

README

          

# Euclids_Algorithm
In mathematics, the Euclidean algorithm, or Euclid's algorithm, is an efficient method for computing the greatest common divisor (GCD) of two integers (numbers),
the largest number that divides them both without a remainder. It is named after the ancient Greek mathematician Euclid, who first described it in his Elements.
It is an example of an algorithm, a step-by-step procedure for performing a calculation according to well-defined rules, and is one of the oldest algorithms in
common use. It can be used to reduce fractions to their simplest form, and is a part of many other number-theoretic and cryptographic calculations.

The Euclidean algorithm is based on the principle that the greatest common divisor of two numbers does not change if the larger number is replaced by its difference
with the smaller number. For example, 21 is the GCD of 252 and 105 (as 252 = 21 × 12 and 105 = 21 × 5), and the same number 21 is also the GCD of 105 and 252 − 105 = 147.
Since this replacement reduces the larger of the two numbers, repeating this process gives successively smaller pairs of numbers until the two numbers become equal.
When that occurs, they are the GCD of the original two numbers. By reversing the steps or using the extended Euclidean algorithm, the GCD can be expressed as a linear
combination of the two original numbers, that is the sum of the two numbers, each multiplied by an integer (for example, 21 = 5 × 105 + (−2) × 252). The fact that the
GCD can always be expressed in this way is known as Bézout's identity.