Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Euclidean algorithm
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== Worst-case ==== If the Euclidean algorithm requires ''N'' steps for a pair of natural numbers ''a'' > ''b'' > 0, the smallest values of ''a'' and ''b'' for which this is true are the [[Fibonacci number]]s ''F''<sub>''N''+2</sub> and ''F''<sub>''N''+1</sub>, respectively.<ref name="Knuth, p. 343">{{harvnb|Knuth|1997}}, p. 343</ref> More precisely, if the Euclidean algorithm requires ''N'' steps for the pair ''a'' > ''b'', then one has ''a'' β₯ ''F''<sub>''N''+2</sub> and ''b'' β₯ ''F''<sub>''N''+1</sub>. This can be shown by [[mathematical induction|induction]].<ref>{{Harvnb|Mollin|2008|p=21}}</ref> If ''N'' = 1, ''b'' divides ''a'' with no remainder; the smallest natural numbers for which this is true is ''b'' = 1 and ''a'' = 2, which are ''F''<sub>2</sub> and ''F''<sub>3</sub>, respectively. Now assume that the result holds for all values of ''N'' up to ''M'' β 1. The first step of the ''M''-step algorithm is ''a'' = ''q''<sub>0</sub>''b'' + ''r''<sub>0</sub>, and the Euclidean algorithm requires ''M'' β 1 steps for the pair ''b'' > ''r''<sub>0</sub>. By induction hypothesis, one has ''b'' β₯ ''F''<sub>''M''+1</sub> and ''r''<sub>0</sub> β₯ ''F''<sub>''M''</sub>. Therefore, ''a'' = ''q''<sub>0</sub>''b'' + ''r''<sub>0</sub> β₯ ''b'' + ''r''<sub>0</sub> β₯ ''F''<sub>''M''+1</sub> + ''F''<sub>''M''</sub> = ''F''<sub>''M''+2</sub>, which is the desired inequality. This proof, published by [[Gabriel LamΓ©]] in 1844, represents the beginning of [[computational complexity theory]],<ref>{{Harvnb|LeVeque|1996|p=35}}</ref> and also the first practical application of the Fibonacci numbers.<ref name="Knuth, p. 343"/> This result suffices to show that the number of steps in Euclid's algorithm can never be more than five times the number of its digits (base 10).<ref>{{Harvnb|Mollin|2008|pp=21β22}}</ref> For if the algorithm requires ''N'' steps, then ''b'' is greater than or equal to ''F''<sub>''N''+1</sub> which in turn is greater than or equal to ''Ο''<sup>''N''β1</sup>, where ''Ο'' is the [[golden ratio]]. Since ''b'' β₯ ''Ο''<sup>''N''β1</sup>, then ''N'' β 1 β€ log<sub>''Ο''</sub>''b''. Since log<sub>10</sub>''Ο'' > 1/5, (''N'' β 1)/5 < log<sub>10</sub>''Ο'' log<sub>''Ο''</sub>''b'' = log<sub>10</sub>''b''. Thus, ''N'' β€ 5 log<sub>10</sub>''b''. Thus, the Euclidean algorithm always needs less than [[Big O notation|''O''(''h'')]] divisions, where ''h'' is the number of digits in the smaller number ''b''.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Euclidean algorithm
(section)
Add topic