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 a,bN+, such that ab (swap them around if a<b)
Output The GCD of a and b
Process
  1. Let A=a
  2. Let B=b
  3. Let R= the remainder of A÷B (see Division algorithm)
  4. If R=0 then:
    1. RETURN: B (we have B=gcd(a,b))
  5. Let A=B
  6. Let B=R
  7. Goto step 3

Proofs of correctness


TODO: These proofs


The algorithm terminates

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

The algorithm computes the GCD

Equally important is the proof that the algorithm always outputs the GCD of a and b


See next

See also

References

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