Description
Euclidean algorithm is used to find the gcd of two integers.
For two sorted integers a,b (a > b)
gcd(a,b)=gcd(a,a mod b)
Proof
Step one: Left to Right
Let a=k1b+r and d is a common divisor of a and b
then
ad=k1bd+rd=m
Because of
d|a∧d|b
m is an integer, which implies
i.e. d is a divisor of r
d is a common divisor of a and
Step two: Right to Left
Let a=k1b+r and d is a common divisor of
From a=k1b+r we get
r=a−k1b
then
rd=ad−k1bd
Because of
d|r∧d|a
then
d|b
So the divisors of a and