The Euclides algorithm

The highest common factor between two integers is the biggest number that divides both.

For example, if we have $20$ and $16$, the highest common factor between the two is $4$, since:

The divisors of $20$ are: $1$, $2$, $4$, $5$, $10$ and $20$

The divisors of $16$ are: $1$, $2$, $4$ and $16$

The numbers that divide either $20$ or $16$ are: $1$, $2$ and $4$, and clearly the biggest is $4$. So, the highest common factor between $20$ and $16$ is $4$, and it is written as $hcf (20,16) = 4$.

Nevertheless, calculating the highest common factor between two numbers can turn out to be much more complicated for very big numbers.

To do so, a method exists which is known as algorithm of Euclides, which, although at first it looks a little bit strange at first, after practiced, it turns out to be much simpler than other methods.

Furthermore, it is also useful for solving diophantine equations.

The Euclides algorithm is based on the definition of three sequences of numbers: the first one is called $r_j$, the second one will be called $s_j$ and the third one $t_j$.

The Euclides algorithm consists in doing the following steps:

Returning to the example that we used on the previous steps, we have seen that for $j = 2$ it is already satisfied that $r_2=0$. Therefore, the highest common factor between $10$ and $5$ is $r_1$ (that of the previous step), that is to say, $5$.

Besides, the last equality says to us that: $$hcf(10,5)=s_1 \cdot 10 + t_1 \cdot 5= 0 \cdot 10 +1 \cdot 5=0$$

Practice exercises