Our major aim is to demonstrate that when the Euclidean algorithm is
invoked with inputs x and y in the interval [1,N], the algorithm
terminates in a mere
steps. Thus, the algorithm runs
in linear time relative to its inputs! Of course, sometimes the
algorithm terminates in only one step (e.g., when x=N and y=N-1).
But we are interested in the worse case. Of all values
,
which lead to the maximum n in (1) above? The answer is
consecutive Fibonacci numbers!
The Fibonacci numbers are the terms in the sequence
that
are defined recursively as follows.
| |
(1) |
Proposition 784
Let Fn be the largest Fibonacci
number that is less than N. Then n is the maximum number of steps
required when the Euclidean algorithm is used to compute the greatest
common divisor of any pair of integers x and y in [1,N] with
.
Proof.Exercise for the reader. ![]()