Steply

Calculate gcd(330, 156) by Euclid's algorithm

Step by step, with the reason for every step · Euclid's algorithm · Discrete Math

Step by step

The question

Question: find gcd(330, 156) by Euclid's algorithm.

gcd(330, 156)

1 Divide the bigger by the smaller

Divide the bigger number by the smaller: 156 goes into 330 2 times, and 18 is left over.

330 = 2 × 156 + 18

Here is the trick.

A number that goes into 330 and 156 also goes into 18, because 18 is 330 minus 2 × 156.

So the gcd does not change, and the numbers get smaller.

gcd(330, 156) = gcd(156, 18)

2 Keep going

Now the same with 156 and 18: the divisor moves left, the remainder becomes the new divisor.

156 = 8 × 18 + 12

18 = 1 × 12 + 6.

18 = 1 × 12 + 6

12 = 2 × 6, and the remainder is 0.

We stop.

12 = 2 × 6 + 0

3 The last remainder before 0

Careful!

0 only tells us to stop.

The answer is the last remainder before it: 6.

Careful: not gcd(330, 156) = 0 ✗

The last remainder that is not 0 is 6.

So gcd(330, 156) = 6.

gcd(330, 156) = 6

4 Check

6 goes into both: 330 ÷ 6 is 55, and 156 ÷ 6 is 26.

330 ÷ 6 = 55, 156 ÷ 6 = 26

And 55 and 26 have no common factor, so nothing bigger than 6 goes into both.

Right!

55 and 26: no common factor

Let's look back.

First: divide the bigger by the smaller.

Then: keep going.

Then: the last remainder before 0.

Last: check.

Answer
gcd(330, 156) = 6

Your turn

Try this one yourself, then check:

gcd(328, 158)
Show the answer
gcd(328, 158) = 2

More from Euclid's algorithm

The whole lesson: Euclid's algorithm →