Logo

Programming-Idioms

History of Idiom 74 > diff from v39 to v40

Edit summary for version 40 by bill:
[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,b
Variables
x,a,b
Code
x = gcd a b
Code
gcd a b
    |   a==b =a
    |   a>b = gcde(a-b) b
    |   otherwise = gcde a (b-a)