09.12.2012 Views

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

290 SPECIAL NUMBERS<br />

in four steps:<br />

@Cm, n) = gcd(no, nl 1<br />

= gcd(nl , n2 1<br />

Then we have<br />

n4<br />

= gcd(nr,n3’l<br />

= gcd(n3, na‘i<br />

= gcd(ns,O) = n4<br />

== n4 = K()n4 ;<br />

n3 =I q4n4 = K(q4h;<br />

w =I qm +n4 = K(q3,q4h;<br />

nl =T q2n2 +n3 = K(qZlq3,q4)n4;<br />

no =T qlnl +w = K(ql,q2,q3,q4h<br />

no = m, nl =n;<br />

n2 = nomodn, = no-qlnl;<br />

n3 = nl mod n2 = nl - q2n2 ;<br />

n4 = nzmodn3 = nz-q3n3;<br />

0 = n3 modn4 = n3 - q4n4.<br />

In general, if Euclid’s algorithm finds the greatest common divisor d in k steps,<br />

after computing the sequence of quotients ql, . . . , qk, then the starting numbers<br />

were K(ql,qz,.. . ,qk)d and K(q2,. . . , qk)d. (This fact was noticed early<br />

in the eighteenth century by Thomas Fantet de Lagny [190], who seems to<br />

have been the first person to consider continuants explicitly. Lagny pointed<br />

out that consecutive Fibonacci numbers, which occur as continuants when the<br />

q’s take their minimum values, are there<strong>for</strong>e the smallest inputs that cause<br />

Euclid’s algorithm to take a given number of steps.)<br />

Continuants are also intimately connected with continued fractions, from<br />

which they get their name. We have, <strong>for</strong> example,<br />

a0 +<br />

1 = K(ao,al,az,a3)<br />

1 -K(al,az,a3) '<br />

a1 + ~<br />

1<br />

a2 + G<br />

(6.135)<br />

The same pattern holds <strong>for</strong> continued fractions of any depth. It is easily<br />

proved by induction; we have, <strong>for</strong> example,<br />

K(ao,al,az,a3+l/a4) := K(ao,al,a2,a3,a4)<br />

K(al, az, a3 + l/a41 K(al,az,as,ad) ’<br />

because of the identity<br />

K,(xl,. . . ,xn-lrxn+Y)<br />

= K,(x,,...,xn~l,x,)+Kn-l(xl,...,xn~l)~<br />

(This identity is proved and generalized in exercise 30.)<br />

(6.136)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!