Math problem, Euclidean algorithm for greatest common divisor.