Next: Formula
Up: Euclid's Algorithm
Previous: Integer Division
Suppose we want to find x such that
.
We use Euclid's algorithm as follows:
In the latter two columns, we multiply the entry above times the
current quotient and add it to the entry two floors above. Example:
,
,
etc.
In the step where we finally obtain remainder 1, we always have
something like
.
It's +1 if it
took an even number of steps, and -1 otherwise. In this case
.
That means
.
So our solution is x=44.
If the final nonzero remainder is greater than 1, that number is
the greatest common factor (or divisor) of the two numbers we
started out with.
Next: Formula
Up: Euclid's Algorithm
Previous: Integer Division
David J. Wright
2000-09-11