get the greatest common divisor