Add a method to compute gcd.