Greatest common divisor: Difference between revisions
Content added Content deleted
(→{{header|AutoHotkey}}: Changed non-recursive version (slightly faster)) |
|||
Line 240: | Line 240: | ||
Return b=0 ? Abs(a) : Gcd(b,mod(a,b)) |
Return b=0 ? Abs(a) : Gcd(b,mod(a,b)) |
||
}</lang> |
}</lang> |
||
Significantly faster than |
Significantly faster than recursion: |
||
<lang AutoHotkey> |
<lang AutoHotkey>GCD(a, b) { |
||
while b |
while b |
||
b := Mod(a | 0x0, a := b) |
|||
return |
return a |
||
}</lang> |
}</lang> |
||