GCD
Calculates the greatest common divisor between two or more numbers.
- Define a
gcd()
function for two numbers, which uses recursion. - Base case is when
y
equals0
, which returnsx
. - Otherwise the GCD of
y
and the remainder of the divisionx/y
is returned. - Use
gcd()
andrange
to apply the calculation to all given numbers.