Greatest common divisor

The greatest common divisor of two numbers, $$x$$ and $$y$$ is the biggest integer that divides both $$x$$ and $$y$$.

This comes in handy when calculating the least common multiple, since $$lcm(a,b) = \frac{ a b }{ gcd(a,b) }$$.

The gcd can be found by using the Euclidean algorithm.