Skip to content

Instantly share code, notes, and snippets.

@shizone
Last active August 29, 2015 14:19
Show Gist options
  • Save shizone/ced7bed01abdae49debc to your computer and use it in GitHub Desktop.
Save shizone/ced7bed01abdae49debc to your computer and use it in GitHub Desktop.
最大公約数
(defn greatest-common-divisor [x y]
(loop [n (min x y)]
(if (and (= (rem x n) 0) (= (rem y n) 0))
n
(recur (dec n))
)
)
)
(greatest-common-divisor 12 18)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment