Steply

Calculate gcd(299, 221) 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(299, 221) by Euclid's algorithm.

gcd(299, 221)

1 Divide the bigger by the smaller

Divide the bigger number by the smaller: 221 goes into 299 once, and 78 is left over.

299 = 1 × 221 + 78

Here is the trick.

A number that goes into 299 and 221 also goes into 78, because 78 is 299 minus 1 × 221.

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

gcd(299, 221) = gcd(221, 78)

2 Keep going

Now the same with 221 and 78: the divisor moves left, the remainder becomes the new divisor.

221 = 2 × 78 + 65

78 = 1 × 65 + 13.

78 = 1 × 65 + 13

65 = 5 × 13, and the remainder is 0.

We stop.

65 = 5 × 13 + 0

3 The last remainder before 0

Careful!

0 only tells us to stop.

The answer is the last remainder before it: 13.

Careful: not gcd(299, 221) = 0 ✗

The last remainder that is not 0 is 13.

So gcd(299, 221) = 13.

gcd(299, 221) = 13

4 Check

13 goes into both: 299 ÷ 13 is 23, and 221 ÷ 13 is 17.

299 ÷ 13 = 23, 221 ÷ 13 = 17

And 23 and 17 have no common factor, so nothing bigger than 13 goes into both.

Right!

23 and 17: 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(299, 221) = 13

Your turn

Try this one yourself, then check:

gcd(302, 224)
Show the answer
gcd(302, 224) = 2

More from Euclid's algorithm

The whole lesson: Euclid's algorithm →