Euclid's Algorithm

Given two numbers (A0, B0), Euclid's Algorithm is an ancient method to determine the highest common factor. The calculations are simple, but it requires an iterative process.

For each iteration, you calculate a new Ai, Bi:
Ai = max(Ai-1,Bi-1) - min(Ai-1,Bi-1)
Bi = min(Ai-1,Bi-1)

After perfroming the calculations, if Ai = Bi, this is the highest common factor