euclid algorithm implementation of greater common divisor of two integers