Published June 2001,February 2011.
See the article Euclid's Algorithm I and try the computer interactivity .
We have also discussed continued fractions. If you have not read the earlier articles, it might be a good idea to look at them before you read this one.
These articles are Continued Fractions I and Continued Fractions II .
We start by evaluating the following continued fraction: $$ 3+ {1 \over \displaystyle 2\;+\; { 1 \over \displaystyle 1\;+\; { 1\over \displaystyle 4}}}. $$ The value of this is $$ 3+{1\over\displaystyle 2+ { 4 \over \displaystyle 5}} = 3+ {5\over\displaystyle 14}= {47\over\displaystyle 14}. $$ Now draw (on graph paper) a rectangle of base 14 units and height 47 units; we shall call this a $14\times 47$ rectangle.
It is easy to see that this rectangle can be divided into THREE $14\times 14$ squares and one $5\times 14$ rectangle. Draw these squares inside the $14\times 47$ rectangle, starting from the bottom. Now take the $5\times 14$ rectangle and divide this into TWO $5\times 5$ squares, and one $4\times 5$ rectangle. Again, you should draw these squares in your diagram. Finally, the $4\times 5$
rectangle can be divided into ONE $4\times 4$ square and one $1\times 4$ rectangle which can itself be divided into FOUR $1\times 1$ squares. Notice that the number of squares found at each stage (written in capital letters) are exactly the numbers appearing in the continued fraction (which has $1$ at the top of each fraction).
Let us try another example: $$ 2+ {1\over\displaystyle 1+ { 1 \over \displaystyle 2+ { 1\over \displaystyle 3}}}= 2+{1\over\displaystyle 1+ { 3 \over \displaystyle 7 }} = 2+ {7\over\displaystyle 10} = { 27 \over \displaystyle 10}. $$ If we follow the instructions given above, we start with a $10\times 27$ rectangle which we divide into TWO $10\times 10$ squares and a $7\times 10$ rectangle.
This last rectangle is divided into ONE $7\times 7$ square and a $3\times 7$ rectangle. The $3\times 7$ rectangle divides into TWO $3\times 3$squares and a $1\times 3$ rectangle which then divides into THREE $1\times 1$ squares.

Check your answers here.
Euclid's algorithm is best known for finding the highest common factor of two whole numbers, which is then used in solving Diophantine equations such as $ax + by = c$ where $a, b$ and $c$ are integers. Note that when the lengths of the edges of the original rectangle are whole numbers, because the rectangles produced by Euclid's algorithm get smaller and smaller and still have edges whose lengths are whole numbers, finally the process must terminate with a rectangle with an edge of 1 unit.
However Euclid's algorithm can also be used in the same way starting with any two numbers, not necessarily whole numbers or even rational numbers, in which case the associated continued fraction is usually an infinite fraction and the process does not terminate. This is useful for quickly finding good rational approximations to irrational numbers.
Suppose for example you want to find a rational approximation to $\pi$. We know that ${22\over 7}$ is used as an approximation but where did that come from, and can we find a better rational approximation? To 7 decimal places $\pi \approx 3.1415927$ which gives ${31415927\over 10000000}$ as a rational approximation but we can do much better than that.
Taking the reciprocal of 0.1415927 we have $$\pi \approx 3+ {1\over\displaystyle 7.0625133}$$ which gives the rational approximation $\pi \approx 3 + {1\over 7} = {22\over 7}$ giving an approximation accurate to 3 significant figures.
For a better approximation, taking the reciprocal of 0.0625133 we have $$ \pi \approx 3+ {1\over\displaystyle 7 + {1\over \displaystyle 15.9966}}.$$ Repeating this algorithm we have $$\pi \approx 3+ {1\over \displaystyle 7 + {1\over \displaystyle 15 + {1\over \displaystyle 1 + {1\over \displaystyle 293 + {1\over \displaystyle 10.320556}}}}}$$ and so on ... This gives the approximation (which is accurate to 7 significant figures): $$\pi \approx 3+ {1\over \displaystyle 7 + {1\over \displaystyle 15 + 1}} = {3 + {16\over 113}} = {355\over 113}.$$