gcd returns the greatest common divisor, which is the largest common factor between two numbers.
gcd(int n, int d)