Euclid’s algorithm
What is the longest piece of ribbon that fits a whole number of times into both 48 cm and 18 cm? Its length is the greatest common divisor.
Lay pieces of length y along x. Store the length left over in r. For example, 48 = 2 × 18 + 12.
A common divisor of x and y divides x − q × y too. The reverse also holds, so (x, y) and (y, r) have the same GCD.
Each remainder is smaller than the divisor. After two divisions the positive divisor is at most half its former size.