gcd(a, 0) = a for any a > 0.
gcd(a, b) = gcd(b, a). Order does not matter.
gcd(a, b) = gcd(a - b, b) if a > b. This is a slower version of the Euclidean algorithm.
If d = gcd(a, b), then gcd(a/d, b/d) = 1. Dividing by GCD makes numbers coprime.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
Useful identities
gcd(a, 0) = a for any a > 0.
gcd(a, b) = gcd(b, a). Order does not matter.
gcd(a, b) = gcd(a - b, b) if a > b. This is a slower version of the Euclidean algorithm.
If d = gcd(a, b), then gcd(a/d, b/d) = 1. Dividing by GCD makes numbers coprime.