Lamé's theorem

From testwiki
Jump to navigation Jump to search

Template:Short description

Lamé's Theorem is the result of Gabriel Lamé's analysis of the complexity of the Euclidean algorithm. Using Fibonacci numbers, he proved in 1844[1][2] that when looking for the greatest common divisor (GCD) of two integers a and b, the algorithm finishes in at most 5k steps, where k is the number of digits (decimal) of b.[3][4]

Statement

The number of division steps in the Euclidean algorithm with entries u and v is less than 5 times the number of decimal digits of min(u,v).

Proof

Let u>v be two positive integers. Applying to them the Euclidean algorithm provides two sequences (q1,,qn) and (v2,,vn) of positive integers such that, setting v0=u, v1=v and vn+1=0, one has

vi1=qivi+vi+1

for i=1,,n, and

u>v>v2>>vn>0.

The number Template:Mvar is called the number of steps of the Euclidean algorithm, since it is the number of Euclidean divisions that are performed.

The Fibonacci numbers are defined by F0=0, F1=1, and

Fn+1=Fn+Fn1

for n>0.

The above relations show that vn1=F2, and vn12=F3. By induction,

vni1=qnivni+vni+1vni+vni+1Fi+2+Fi+1=Fi+3.

So, if the Euclidean algorithm requires Template:Mvar steps, one has vFn+1.

One has Fkφk2 for every integer k>2, where φ=1+52 is the Golden ratio. This can be proved by induction, starting with F2=φ0=1, F3=2>φ, and continuing by using that φ2=φ+1:

Fk+1=Fk+Fk1φk2+φk3=φk3(1+φ)=φk1.

So, if Template:Mvar is the number of steps of the Euclidean algorithm, one has

vφn1,

and thus

n1log10vlog10φ<5log10v,

using 1log10φ<5.

If Template:Mvar is the number of decimal digits of v, one has v<10k and log10v<k. So,

n1<5k,

and, as both members of the inequality are integers,

n5k,

which is exactly what Lamé's theorem asserts.

As a side result of this proof, one gets that the pairs of integers (u,v) that give the maximum number of steps of the Euclidean algorithm (for a given size of v) are the pairs of consecutive Fibonacci numbers.

References

Template:Reflist

Bibliography

  • Bach, Eric (1996). Algorithmic number theory. Jeffrey Outlaw Shallit. Cambridge, Mass.: MIT Press. Template:ISBN. Template:OCLC
  • Carvalho, João Bosco Pitombeira de (1993). Olhando mais de cima: Euclides, Fibonacci e Lamé. Revista do Professor de Matemática, São Paulo, n. 24, p. 32-40, 2 sem.