GCD Euclidean algorithm
a, b greatest common divisor (Greatest Common Divisor), equal to b, a% b is the greatest common divisor, the following formula
GCD (A, B) = GCD (B, A% B) GCD (A, B) = GCD (B, A% B)
GCD (A, B) = GCD (B, A% B)
taken from
Euclid algorithm (quality method for solving the greatest common divisor) and the principle of expansion
This pseudo-code algorithm implemented
Begin
inputs A, B
A to B modulo result assigned to R
if R = 0, then B is the greatest common divisor
If R is not equal to 0, places B to A, B to R as the cycle step