Slightly faster method to verify gcd