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.

Try it

GCD(252, 105)

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