Topics

It efficiently computes the Greatest Common Divisor (GCD) and has variations crucial for solving complex problems.

gcd(a, b) = gcd(b, a % b) until b = 0.

3 popular variants:

The applications are plenty:

Tip

In array GCD, exit early if intermediate GCD becomes 1.