Skip to content
Number Theory Guide

Number Theory Level 13: GCD (<= 200). Euclidean algorithm.

1. First Euclid step

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

Replace the larger number with its remainder.

180 = 126 + 54.

2. Repeat with remainder

2. Repeat with remainder
First Euclid step

Continue with the new pair.

126 = 54 x 2 + 18.

3. Reach exact division

3. Reach exact division
First Euclid step
Repeat with remainder

Stop when the remainder is zero.

54 = 18 x 3.

4. Read GCD

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

The last nonzero divisor is the GCD.

GCD = 18.