Skip to content

Instantly share code, notes, and snippets.

@ninthdrug
Last active February 9, 2017 22:34
Show Gist options
  • Save ninthdrug/5bbeeb78a6f14a96aa85bcc2d6b48791 to your computer and use it in GitHub Desktop.
Save ninthdrug/5bbeeb78a6f14a96aa85bcc2d6b48791 to your computer and use it in GitHub Desktop.
gcd and lcm in haskell
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