1.7: Lame's Theorem
 Page ID
 8972
In this section, we give an estimate to the number of steps needed to find the greatest common divisor of two integers using the Euclidean algorithm. To do this, we have to introduce the Fibonacci numbers for the sake of proving a lemma that gives an estimate on the growth of Fibonacci numbers in the Fibonacci sequence. The lemma that we prove will be used in the proof of Lame’s theorem.
The Fibonacci sequence is defined recursively by \(f_1=1\), \(f_2=1\), and \[f_{n}=f_{n1}+f_{n2} \mbox{for} \ \ n\geq 3.\] The terms in the sequence are called Fibonacci numbers.
In the following lemma, we give a lower bound on the growth of Fibonacci numbers. We will show that Fibonacci numbers grow faster than a geometric series with common ratio \(\alpha=(1+\sqrt{5})/2\).
[lem2] For \(n\geq 3\), we have \(f_n>\alpha^{n2}\) where \(\alpha=(1+\sqrt{5})/2\).
We use the second principle of mathematical induction to prove our result. It is easy to see that this is true for \(n=3\) and \(n=4\). Assume that \(\alpha^{k2}<f_k\) for all integers \(k\) where \(k\leq n\). Now since \(\alpha\) is a solution of the polynomial \(x^2x1=0\), we have \(\alpha^2=\alpha+1\). Hence \[\alpha^{n1}=\alpha^2.\alpha^{n3}=(\alpha+1).\alpha^{n3}=\alpha^{n2}+\alpha^{n3}.\] By the inductive hypothesis, we have \[\alpha^{n2}<f_n, \ \ \ \alpha^{n3}<f_{n1}.\] After adding the two inequalities, we get \[\alpha^{n1}<f_{n}+f_{n1}=f_{n+1}.\]
We now present Lame’s theorem.
using the Euclidean algorithm to find the greatest common divisor of two positive integers has number of divisions less than or equal five times the number of decimal digits in the minimum of the two integers.
Let \(a\) and \(b\) be two positive integers where \(a>b\). Applying the Euclidean algorithm to find the greatest common divisor of two integers with \(a=r_0\) and \(b=r_1\), we get \[\begin{aligned} r_0&=&r_1q_1+r_2 \ \ \ \ \ 0\leq r_2<r_1, \\ r_1&=&r_2q_2+r_3 \ \ \ \ \ 0\leq r_3<r_2, \\ &.& \\ &.& \\ &.& \\ r_{n2}&=&r_{n1}q_{n1}+r_{n} \ \ \ \ \ 0\leq r_{n}<r_{n1}, \\ r_{n1}&=&r_{n}q_{n}.\end{aligned}\] Notice that each of the quotients \(q_1,q_2,...,q_{n1}\) are all greater than 1 and \(q_n\geq 2\) and this is because \(r_n<r_{n1}\). Thus we have \[\begin{aligned} r_n&\geq& 1=f_2,\\ r_{n1}&\geq& 2r_n\geq 2f_2=f_3,\\ r_{n2}&\geq& r_{n1}+r_n\geq f_3+f_2=f_4,\\ r_{n3}&\geq& r_{n2}+r_{n1}\geq f_4+f_3=f_5,\\ &.&\\ &.&\\ &.&\\ r_2&\geq& r_3+r_4\geq f_{n1}+f_{n2}=f_n,\\ b&=& r_1\geq r_2+r_3\geq f_n+f_{n1}=f_{n+1}.\end{aligned}\] Thus notice that \(b\geq f_{n+1}\). By Lemma [lem2], we have \(f_{n+1}>\alpha^{n1}\) for \(n>2\). As a result, we have \(b>\alpha^{n1}\). Now notice since \[\log_{10}\alpha>\frac{1}{5},\] we see that \[log_{10}b>(n1)/5.\] Thus we have \[n1<5log_{10}b.\] Now let \(b\) has \(k\) decimal digits. As a result, we have \(b<10^k\) and thus \(log_{10}b<k\). Hence we conclude that \(n1<5k\). Since \(k\) is an integer, we conclude that \(n\leq 5k\).
Exercises

Find an upper bound for the number of steps in the Euclidean algorithm that is used to find the greatest common divisor of 38472 and 957748838.

Find an upper bound for the number of steps in the Euclidean algorithm that is used to find the greatest common divisor of 15 and 75. Verify your result by using the Euclidean algorithm to find the greatest common divisor of the two integers.
Contributors
Dr. Wissam Raji, Ph.D., of the American University in Beirut. His work was selected by the Saylor Foundation’s Open Textbook Challenge for public release under a Creative Commons Attribution (CC BY) license.