Euclid's Algorithm: An Analysis
blog.adamdklein.com
blog.adamdklein.com
221 = 2 * 85 + 51
85 = 51 + 34
51 = 34 + 17
34 = 2 * 17 + 0
So our GCD is 17. Why? Well, if we rearrange the parts, we get... 51 = 34 + 17, so 51 = (2 * 17) + 17 = 3 * 17
85 = 51 + 34 = (3 * 17) + (2 * 17)
85 = 5 * 17
221 = 2 * (5 * 17) + (3 * 17)
221 = 13 * 17
So 221 and 85 are both divisible by 17.Bonus: This also gives us a way to write 17 as an integral combination of 221 and 85. We also get this by rearranging the parts:
17 = 51 - 34
34 = 85 - 51
51 = 221 - 2 * 85
so 17 = 51 - (85 - 51)
17 = 2 * 51 - 85
17 = 2 * (221 - 2 * 85) - 85
17 = 2 * 221 - 3 * 85The original importance of Euclid's algorithm was that it made calculations with ratios easier. And the reason why that was important was currency conversions.
It is used today in cryptography, which is used for online financial transactions.
One way or another, it all comes down to money. :-)
a=24: a a a a a a a a a a a a a a a a a a a a a a a a
b=18: b b b b b b b b b b b b b b b b b b
d= 2: d d|d d|d d|d d|d d|d d|d d|d d|d d|d d|d d|d d
d= 3: d d d|d d d|d d d|d d d|d d d|d d d|d d d|d d d|
d= 4: d d d d|d d d d|d d d d|d d d d|d d d d|... no good;
multiples of d must hit the ends of b and a d: | | |
b=18: b b b b b b b b b b b b b b b b b b
a-b : a a a a a a
d: | | |
b-(a-b): b b b b b b b b b b b b
a-b : a a a a a a
d: | | |
b-(a-b)-(a-b): b b b b b b
a-b : a a a a a a
d: | |
d=6