subatomiconsciousness:

Euclid’s algorithm, is a method for computing the greatest common divisor (GCD) of two (usually positive) integers, also known as the greatest common factor (GCF) or highest common factor (HCF).

The GCD of two positive integers is the largest integer that divides both of them without leaving a remainder

In its simplest form, Euclid’s algorithm starts with a pair of positive integers, and forms a new pair that consists of the smaller number and the difference between the larger and smaller numbers. The process repeats until the numbers in the pair are equal. That number then is the greatest common divisor of the original pair of integers.

The main principle is that the GCD does not change if the smaller number is subtracted from the larger number. For example, the GCD of 252 and 105 is exactly the GCD of 147 (= 252 − 105) and 105. Since the larger of the two numbers is reduced, repeating this process gives successively smaller numbers, so this repetition will necessarily stop sooner or later — when the numbers are equal (if the process is attempted once more, one of the numbers will become 0).

Animation of the Euclidean algorithm for 1071 and 462. The initial green rectangle has dimensions a = 1071 and b = 462. Square 462×462 tiles are added until a green 462×147 rectangle remains. This is tiled with square 147×147 tiles until a 21×147 rectangle remains. This third rectangle is tiled with 21×21 square tiles, leaving no remainder. Thus, 21 is the greatest common divisor of 1071 and 462.

x

So basically

(1) 1071×462 – 462×462 = 609×462

(2) 609×462 – 462×462 = 147×462

(3) 462×147 – 147×147 = 315×147

(4) 315×147 – 147×147 = 168×147

(5) 168×147 – 147×147 = 21×147

((6) to (12)) 147×21 – 7*21×21 = 0

So yup this is a way to find the GCD of 2 numbers without knowing their factors. It works simply because ”the GCD does not change if the smaller number is subtracted from the larger number”
—> abcghi – abcwxy = abc(ghi-wxy) —> the common factors can never go away. At the end, by repeating the process described earlier, the two last numbers left will be equal, which means they have the same factors; which means it’s the GCD (because the process got rid of every other multiples of two initial numbers)

Thanks for explaining. 😉