# 2.1 GCDs

## GCDs I

Consider the two integers:
$$a = 21212121$$
$$b = 12121212$$

1. What is the GCD of $$a$$ and $$b$$?

Hint: Looks scary, but it's not.

Exercise 1

We run the algorithm:

$GCD(21212121,12121212)\\ = GCD(12121212,9090909)\\ = GCD(9090909,3030303)\\ = GCD(3030303,0).$

2. How many steps of the Euclidean algorithm are needed to compute this GCD?

A step of the Euclidean algorithm is defined as an application of the equation:

$$GCD(x,y) = GCD(y, rem(x, y)).$$

The algorithm begins with $$(a,b)$$ and ends with $$(gcd(a,b),0)$$.

In the execution of the algorithm in Part 1 we needed 3 applications of the equation.
Exercise 2