History of Idiom 74 > diff from v39 to v40
Edit summary for version 40 :
[Haskell] Other implementation.
[Haskell] Other implementation.
↷
Version 39
2020-10-08, 12:45:30
Version 40
2020-11-23, 04:48:31
Idiom #74 Compute GCD
Compute the greatest common divisor x of big integers a and b. Use an integer type able to handle huge numbers.
Idiom #74 Compute GCD
Compute the greatest common divisor x of big integers a and b. Use an integer type able to handle huge numbers.
Variables
x,a,bVariables
x,a,bCode
x = gcd a b
Code
gcd a b | a==b =a | a>b = gcde(a-b) b | otherwise = gcde a (b-a)