Itereative and recursive implementations of Euclid's algorithm