[Haskell-beginners] extended gcd

Zbigniew Stanasiuk zbigergofun at gmail.com
Tue Dec 11 14:53:28 CET 2012


Hallo everyone,

I try to understand how the following recursive function works:

extGCD :: Integer -> Integer -> [Integer]
extGCD a 0 = [1, 0, a]
extGCD a b = let (q, r) = a `quotRem` b
                        [s, t, g] = extGCD b r
                     in  [t, s - q * t, abs g]

 Some hints to explain??

Regards,
Z.Stanasiuk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20121211/95985509/attachment.htm>


More information about the Beginners mailing list