Euclidean algorithm
The extended Euclidean algorithm proceeds similarly, but adds two other sequences, as follows