Skip to content

Instantly share code, notes, and snippets.

@jukworks
Created October 15, 2013 13:09
Show Gist options
  • Save jukworks/6991319 to your computer and use it in GitHub Desktop.
Save jukworks/6991319 to your computer and use it in GitHub Desktop.
Euclid GCD(greatest common divisor) in Clojure
(defn euclid-gcd [m n]
(let [r (mod m n)]
(if (zero? r)
n
(euclid-gcd n r))))
;; (euclid-gcd 2166 6099) => 57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment