Section 1.2
Euclid's algorithm

The gcd of two integers a and b (which, for simplicity, we assume to be positive) can be determined with Euclid's algorithm.

Euclid


Euclid's algorithm


  1. Replace (simultaneously)
    • a by b and
    • b by the remainder of the division of a by b.
  2. Repeat Step 1 until b is equal to 0.
  3. Return a.