Calculates the greatest common divisor (GCD) of two integers using the Euclidean algorithm.
First integer.
Second integer.
The greatest common divisor of a and b.
a
b
Will throw an error if either number is not an integer.
gcd(48, 18); // returns 6gcd(7, 1); // returns 1 Copy
gcd(48, 18); // returns 6gcd(7, 1); // returns 1
Calculates the greatest common divisor (GCD) of two integers using the Euclidean algorithm.