Math Playground
Numbers

Euclidean algorithm

The fastest way to find the GCD — repeatedly subtract or take remainders.

The fastest way to find the greatest common divisor of two numbers — repeatedly take remainders.

Walk through
Step 1 of 4
Start: gcd(252, 105)

Divide the larger by the smaller, keep the remainder: 252 = 2 × 105 + 42.

Try it

GCD(252, 105)

252 = 2·105 + 42. 105 = 2·42 + 21. 42 = 2·21 + 0. GCD = 21.