The Euclidean algorithm is an effective algorithm for finding the greatest common divisor of two integers. It is named after the Greek mathematician Euclid, who invented in VII century.
In the most simple case, Euclidean algorithm is applied to a pair of positive integers and generates a new pair consisting of a smaller number, and the modulo between the larger and the smaller number. The process is repeated until the found number will be the greatest common divisor of the original pair.
The extended Euclidean algorithm also finds such coefficients x and y that: