Skip to content
Number Theory Guide

Number Theory Level 14: GCD (<= 300). Euclidean algorithm.

1. First Euclid step

1. First Euclid step
Replace the pair with divisor and remainder.

Replace the larger number with its remainder.

252 = 180 + 72.

2. Repeat with remainder

2. Repeat with remainder
First Euclid step

Continue with the new pair.

180 = 72 x 2 + 36.

3. Reach exact division

3. Reach exact division
First Euclid step
Repeat with remainder

Stop when the remainder is zero.

72 = 36 x 2.

4. Read GCD

4. Read GCD
First Euclid step
Repeat with remainder
Reach exact division

The last nonzero divisor is the GCD.

GCD = 36.