Difference between revisions of "Euclidean algorithm"

From Maths
Jump to: navigation, search
(Created page with "'''Note:''' this is an algorithm for computing the GCD of two positive integers ==Definition== The algorithm is as follows<ref>The mathematics of ciphers, Number theory a...")
 
m
 
Line 30: Line 30:
 
===The algorithm computes the GCD===
 
===The algorithm computes the GCD===
 
Equally important is the proof that the algorithm always outputs the [[GCD]] of {{M|a}} and {{M|b}}
 
Equally important is the proof that the algorithm always outputs the [[GCD]] of {{M|a}} and {{M|b}}
 +
 +
 +
==See next==
 +
* [[Extended Euclidean algorithm]]
 +
 +
==See also==
 +
* [[GCD]]
 +
* [[Divisor]]
 +
* [[Division algorithm]]
  
 
==References==
 
==References==

Latest revision as of 08:53, 21 May 2015

Note: this is an algorithm for computing the GCD of two positive integers

Definition

The algorithm is as follows[1]:

Input [ilmath]a,b\in\mathbb{N}_+[/ilmath], such that [ilmath]a\ge b[/ilmath] (swap them around if [ilmath]a< b[/ilmath])
Output The GCD of [ilmath]a[/ilmath] and [ilmath]b[/ilmath]
Process
  1. Let [ilmath]A=a[/ilmath]
  2. Let [ilmath]B=b[/ilmath]
  3. Let [ilmath]R=[/ilmath] the remainder of [ilmath]A\div B[/ilmath] (see Division algorithm)
  4. If [ilmath]R=0[/ilmath] then:
    1. RETURN: [ilmath]B[/ilmath] (we have [ilmath]B=\text{gcd}(a,b)[/ilmath])
  5. Let [ilmath]A=B[/ilmath]
  6. Let [ilmath]B=R[/ilmath]
  7. Goto step 3

Proofs of correctness


TODO: These proofs


The algorithm terminates

Given this algorithm loops until [ilmath]R=0[/ilmath] it is important to know for certain that eventually we will have [ilmath]R=0[/ilmath]

The algorithm computes the GCD

Equally important is the proof that the algorithm always outputs the GCD of [ilmath]a[/ilmath] and [ilmath]b[/ilmath]


See next

See also

References

  1. The mathematics of ciphers, Number theory and RSA cryptography - S. C. Coutinho