[Home]History of Greatest common divisor

HomePage | Recent Changes | Preferences

Revision 21 . . December 17, 2001 7:09 am by AxelBoldt [fixed complexity discussion]
Revision 20 . . December 17, 2001 7:01 am by Hannes Hirzel [moved up complexity indication]
Revision 19 . . (edit) December 17, 2001 6:59 am by Hannes Hirzel
Revision 18 . . (edit) December 17, 2001 6:59 am by Hannes Hirzel
Revision 17 . . (edit) December 17, 2001 6:54 am by Taw [/Talk]
Revision 16 . . December 17, 2001 6:51 am by Hannes Hirzel [Added Javascript implementation]
Revision 15 . . November 16, 2001 2:33 am by AxelBoldt [some more properties.]
  

Difference (from prior major revision) (no other diffs)

Changed: 63c63
When analyzing the runtime of Euclid's algorithm, it turns out that the inputs requiring the most steps are two successive Fibonacci numbers, and the worst case runtime is O(n), where n is the number of digits in the input (see Big O).
When analyzing the runtime of this version of Euclid's algorithm, it turns out that the inputs requiring the most steps are two successive Fibonacci numbers, and the worst case requires O(n) divisions, where n is the number of digits in the input (see Big O).

Changed: 65,66c65

The following code shows a Javascript implementation of Euclid's original version shown under algorithm.
Euclid originally formulated the problem geometrically, as the problem of finding a common "measure" for two line lengths, and his algorithm proceeded by repeated subtraction of the shorter from the longer segment. This is illustrated in the following Javascript implementation which should work in most web browsers.

Removed: 79d77


Changed: 81c79
{a = a - b}
{a = a - b}

Removed: 90,91d87
Can be readily used in most browsers.


Added: 92a89



HomePage | Recent Changes | Preferences
Search: