add greatest common divisor algorithm