Euclidean Algorithm
== Algorithm ==  The '''Euclidean algorithm''' is a method for finding the greatest common divisor (GCD) of two integers $a$ and $b$. Let $a, b \in \Z$ and $a \ne 0 \lor b \ne 0$. The steps are: :$(1): \quad$ Start with $\tuple {a, b}$ such that $\size a \ge \size b$. If $b = 0$ then the task is complete and the GCD is $a$. :$(2): \quad$ If $b \ne 0$ then you take the remainder $r$ of $\dfrac a b$. :$(3): \quad$ Set $a \gets b, b \gets r$ (and thus $\size a \ge \size b$ again). :$(4): \quad$ Repeat these steps until $b = 0$. Thus the GCD of $a$ and $b$ is the value of the variable $a$ after the termination of the algorithm.  {{:Euclid:Proposition/VII/2}} == Proof 1 == {{:Euclidean Algorithm/Proof 1}} == Euclid's Proof == {{:Euclidean Algorithm/Euclid's Proof}} == Demonstration == {{:Euclidean Algorithm/Demonstration}} == Algorithmic Nature == {{:Euclidean Algorithm/Algorithmic Nature}} == Formal Implementation == {{:Euclidean Algorithm/Formal Implementation}} == Constructing an Integer Combination == {{:Euclidean Algorithm/Construction of Integer Combination}} == Also known as == The '''Euclidean algorithm''' is also known as '''Euclid's algorithm''' or the '''Euclidean division algorithm'''. == Examples == {{:Euclidean Algorithm/Examples}} == Also see == * Rational Numbers and SFCFs are Equivalent for an application of the '''Euclidean algorithm''' in a slightly different context. {{Euclid Note|2|VII}} {{Namedfor|Euclid|cat = Euclid}} == Sources == * {{BookReference|Introduction to Abstract Algebra|1969|C.R.J. Clapham|prev = Bézout's Lemma/Proof 2|next = Definition:Prime Number/Definition 2}}: $\S 3.11$ * {{BookReference|Number Theory|1971|George E. Andrews|prev = Euclidean Algorithm/Examples/341 and 527|next = Euclidean Algorithm/Demonstration}}: $\text {2-2}$ Divisibility: Theorem $\text {2-2}$ * {{BookReference|Elements of Abstract Algebra|1971|Allan Clark|prev = GCD and LCM Distribute Over Each Other|next = Euclidean Algorithm/Euclid's Proof}}: Chapter $1$: Properties of the Natural Numbers: $\S 23 \zeta$ * {{BookReference|An Introduction to Abstract Algebra|1978|Thomas A. Whitelaw|prev = Prime not Divisor implies Coprime|next = Euclidean Algorithm/Demonstration}}: $\S 12$: Highest common factors and Euclid's algorithm * {{BookReference|Curious and Interesting Numbers|1986|David Wells|prev = Abel-Ruffini Theorem/Historical Note|next = Lamé's Theorem/Historical Note}}: $5$ * {{BookReference|Dictionary of Mathematics|1989|Ephraim J. Borowski|author2 = Jonathan M. Borwein|prev = Definition:Euclidean|next = Definition:Euclidean Construction|entry = Euclidean algorithm}} * {{BookReference|Dictionary of Mathematics|1989|Ephraim J. Borowski|author2 = Jonathan M. Borwein|prev = Definition:Perfect Number|next = Axiom:Euclid's Postulates|entry = Euclid's algorithm''' or '''Euclidean algorithm}} * {{BookReference|A Course in Group Theory|1996|John F. Humphreys|prev = Definition:Greatest Common Divisor/Integers/Definition 2|next = Euclidean Algorithm/Demonstration}}: $\text{A}.1$: Number theory * {{BookReference|The Art of Computer Programming: Volume 1: Fundamental Algorithms|1997|Donald E. Knuth|ed = 3rd|edpage = Third Edition|prev = Definition:Algorithm/Linguistic Note|next = Definition:Greatest Common Divisor/Integers/Definition 1}}: $\S 1.1$: Algorithms: Algorithm $\text{E}$ * {{BookReference|Curious and Interesting Numbers|1997|David Wells|ed = 2nd|edpage = Second Edition|prev = Abel-Ruffini Theorem/Historical Note|next = Lamé's Theorem/Historical Note}}: $5$ * {{BookReference|The Penguin Dictionary of Mathematics|1998|David Nelson|ed = 2nd|edpage = Second Edition|prev = Mathematician:Euclid|next = Definition:Euclidean Construction|entry = Euclidean algorithm}} * {{BookReference|The Penguin Dictionary of Mathematics|2008|David Nelson|ed = 4th|edpage = Fourth Edition|prev = Mathematician:Euclid|next = Lamé's Theorem|entry = Euclidean algorithm}} * {{BookReference|The Concise Oxford Dictionary of Mathematics|2014|Christopher Clapham|author2 = James Nicholson|ed = 5th|edpage = Fifth Edition|prev = Mathematician:Euclid|next = Definition:Euclidean Construction|entry = Euclidean Algorithm}}