Euclidean algorithm
From Maths
Note: this is an algorithm for computing the GCD of two positive integers
Contents
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 |
|
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
- ↑ The mathematics of ciphers, Number theory and RSA cryptography - S. C. Coutinho