|Published (Last):||14 May 2013|
|PDF File Size:||14.9 Mb|
|ePub File Size:||17.15 Mb|
|Price:||Free* [*Free Regsitration Required]|
In mathematicsthe Euclidean algorithm[note 1] or Euclid’s algorithmis an efficient method for computing the greatest common divisor GCD of two numbers, the largest number that divides both of them without leaving a remainder.
It is named after the ancient Greek mathematician Euclidwho first described algorjtma in his Elements c. It is an example of an algorithma step-by-step procedure for performing a allgoritma 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 formand 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 eucoid does not change if the larger number is replaced by its difference with the smaller number.
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 Eiclid of the original two numbers. By reversing the stepsthe GCD can be expressed as a sum of the two original numbers each multiplied by a positive or negative integere. The version of the Euclidean algorithm described above and by Euclid can take many subtraction steps to find the GCD when one of the given numbers is agloritma bigger than the other.
Euclidean algorithm – Wikipedia
A more efficient version of the algorithm shortcuts these steps, instead replacing the larger of the two numbers by its remainder when divided by the smaller of the two with this version, the algorithm stops when reaching a zero remainder.
With this improvement, the algorithm never requires algorittma steps than five times the number of digits base 10 of the smaller integer.
Additional methods for improving the algorithm’s efficiency were developed in the 20th century. The Euclidean algorithm has many theoretical and practical applications. It is used for reducing fractions to their simplest form and for performing division in modular arithmetic. Computations using this algorithm form part of the cryptographic protocols that are used to secure internet communications, and in methods for breaking these cryptosystems by factoring large composite numbers.
The Euclidean algorithm may be used to solve Diophantine equationssuch as finding numbers that satisfy multiple congruences according to the Chinese remainder theoremto construct continued fractionsand to find accurate rational approximations to real numbers.
Finally, it can be eucli as a basic tool for proving theorems in number theory such euclld Lagrange’s four-square theorem and the uniqueness of prime factorizations. The original algorithm was described only for natural numbers and geometric lengths real numberseucldi the algorithm was generalized in the 19th akgoritma to other types of numbers, such as Gaussian integers and polynomials of one variable. This led to modern abstract algebraic notions such as Euclidean domains.
The Euclidean algorithm calculates the greatest common divisor GCD of two natural numbers a and a,goritma. The greatest common divisor g is the largest natural number that divides both a and b without leaving a remainder. Nevertheless, 6 and 35 are coprime. No natural number other than 1 divides both 6 and 35, since they have no prime factors in common.
Euuclid natural numbers m and n must be coprime, since any common factor could be factored out of m and n to make g greater. Thus, any other number c that divides both a and b must also divide g. The greatest common divisor g of a and b is the unique positive common divisor of a and b that is divisible by any other common divisor c.
The GCD can be visualized as follows. The sides of the rectangle can be divided into segments of length cwhich divides the rectangle into a grid of squares of side length c.
The duclid common divisor g is the largest value of c for which this is possible. For illustration, a by rectangular area can be divided into a grid of: Therefore, 12 is the greatest common divisor of 24 and The GCD of two numbers a and b is the product of the prime factors shared by the two numbers, where a same prime factor can be used multiple times, but only as long as the product of these factors divides both a and b.
If two numbers have no prime factors in common, their greatest common divisor is 1 obtained here as an instance of the empty productin other words they are coprime. A key advantage of the Euclidean algorithm is that it can find the GCD efficiently without euclic to compute the prime factors.
Another definition of the GCD is helpful in advanced mathematics, particularly ring theory. The set of all integral linear combinations of a and b is actually the same as the set of all multiples of g mgwhere m is an integer. The equivalence of this GCD definition with the other definitions is described below.
The GCD of three or more numbers equals the product of the prime factors common to all the numbers,  but it can also be calculated by repeatedly taking the GCDs of pairs of numbers.
The Euclidean algorithm proceeds in a series of steps such that the output of each step is used as an input for the next one. Let k be an integer that counts the steps of the algorithm, starting algoritam zero. The goal of the k th step is to find a quotient q k and remainder r k that satisfy the equation.
Thus, the algorithm can be written as a sequence of equations. If a is smaller than bthe first step of the algorithm swaps the numbers. Since the remainders decrease with every step but can never be negative, a remainder r N must eventually equal zero, at which point the algorithm stops.
The number N cannot be infinite because there are only a finite number of nonnegative integers between the initial algoritms r 0 and apgoritma. The validity of the Euclidean algorithm can be proven by a two-step argument. Since it is a common divisor, it must be less than or equal to the greatest common divisor g.
In the second step, any natural number c that divides both a and b in other words, any common divisor of a and b divides the remainders r k. By definition, a and b can be written as multiples of c: An analogous argument shows that c also divides the subsequent remainders r 1r 2etc.
Thus, g is the greatest common divisor of all the succeeding pairs: To begin, multiples of are subtracted from until the remainder is less than Then multiples of are subtracted from until the remainder is less than Then multiples of 21 are subtracted from until the remainder is less than Since the last remainder is zero, the algorithm ends with 21 as the greatest common divisor of and This agrees with the gcdfound by prime factorization above.
In tabular form, the steps are. The Euclidean algorithm can be visualized in terms of the tiling analogy given above for the greatest common divisor. We then attempt to tile the residual rectangle with r 0 -by- r 0 square tiles. This leaves a second residual rectangle r 1 -by- r 0which we attempt to tile using r 1 -by- r 1 square tiles, and so on.
The sequence ends when there is no residual rectangle, i. The length of the sides of the smallest square tile is the GCD of the dimensions of the original rectangle. For example, the eucid square tile in the adjacent figure is by shown in redand 21 is the GCD of andthe dimensions of the original rectangle shown in green.
The theorem which underlies the definition of the Euclidean division ensures that such a quotient and remainder always exist and are unique. Euclidean division reduces all the steps between two exchanges into a single step, which is thus more efficient. Moreover, the quotients are not needed, thus one may replace Euclidean division by the modulo operationalggoritma gives only the remainder.
Thus the iteration of the Euclidean algorithm becomes simply.
Implementations of the algorithm may be expressed in pseudocode. For example, the division-based version may be programmed as . During the loop iteration, a euclic reduced by multiples of the previous remainder b until a is smaller than b. Then a is the next remainder r k. In another version of Euclid’s algorithm, the quotient at each step is increased by one if the resulting negative remainder is smaller in magnitude than the typical positive remainder.
However, an alternative negative remainder e k can be computed:. If r k is replaced by e k. Leopold Kronecker has shown that this version requires the least number of steps of any version of Euclid’s algorithm. The Euclidean algorithm is one of the oldest algorithms in common use. In modern usage, one would say it was formulated there for real numbers.
But lengths, areas, and volumes, represented as real numbers in modern usage, are not measured in the same units and there is no natural unit of algkritma, area, or volume; the concept of real numbers was unknown at that time.
The latter algorithm is geometrical. The algorithm was probably not discovered by Euclidalgortma compiled results from earlier mathematicians in his Elements. Centuries later, Euclid’s algorithm was discovered independently both in India and in China,  primarily to solve Diophantine equations that arose in astronomy and making accurate calendars.
In the late 5th century, the Indian mathematician and astronomer Aryabhata described the algorithm as the “pulverizer”,  perhaps because of its effectiveness in solving Diophantine equations. The extended Euclidean algorithm was published by the English algoirtma Nicholas Saunderson who attributed it to Roger Cotes as a method for computing continued fractions efficiently. In the 19th century, the Euclidean algorithm led to the development of new number systems, such as Gaussian integers and Eisenstein integers.
InCarl Gauss used the Euclidean algorithm to demonstrate unique factorization of Gaussian integersalthough his work was first published in For example, Dedekind was the first to prove Fermat’s two-square theorem using the unique factorization of Gaussian integers. In the closing decades of euclic 19th century, the Euclidean algorithm gradually became eclipsed by Dedekind’s more general theory of ideals. Other applications of Euclid’s algorithm were developed in the 19th century.
InCharles Sturm showed that the algorithm was useful in the Sturm chain method for counting the real roots of polynomials in any given interval. The Euclidean algorithm was the first integer relation algorithmwhich is a method for finding integer relations between commensurate real euclic. Several novel integer relation algorithms have been developed, such as the algorithm of Helaman Ferguson and R.
Forcade  and the LLL algorithm. InCole and Davie developed a two-player game based on the Euclidean algorithm, called The Game of Euclid which has an optimal altoritma.
The players take turns removing m multiples of eclid smaller pile from the larger.
The winner eculid the first player to reduce one pile to zero stones. The integers s and t zlgoritma be calculated from the quotients q 0q 1etc. Those two remainders can be likewise expressed in terms of their quotients and preceding remainders.
The process of substituting remainders by formulae involving their predecessors can be continued until the original numbers a and b are reached:. After all the remainders r 0r 1etc.