Exit
Lesson 053 · Step 1 of 5Streak 00

Euclid’s algorithm

gcd⁡(a,b)\gcd(a, b) is the largest integer dividing both aa and bb.

If a=b⋅q+ra = b\cdot q + r, then gcd⁡(a,b)=gcd⁡(b,r)\gcd(a, b) = \gcd(b, r). Repeat until the remainder is 00. The last non-zero remainder is the gcd.

  1. 0148=2⋅18+1248 = 2\cdot 18 + 12Divide
  2. 0218=1⋅12+618 = 1\cdot 12 + 6Divide
  3. 0312=2⋅6+012 = 2\cdot 6 + 0Remainder 00
  4. 04The last non-zero remainder is 66, so gcd⁡(48,18)=6\gcd(48, 18) = 6.Conclusion