Last active
February 9, 2017 22:34
-
-
Save ninthdrug/5bbeeb78a6f14a96aa85bcc2d6b48791 to your computer and use it in GitHub Desktop.
gcd and lcm in haskell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gcd a b = | |
let r = a `mod` b | |
in if r == 0 then b else gcd b r | |
lcm a b = a * b / (gcd a b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment