Skip to content

Instantly share code, notes, and snippets.

@ochronus
Created April 1, 2016 13:27
Show Gist options
  • Select an option

  • Save ochronus/8a827240b57556522cf9d1b1bdb01ad5 to your computer and use it in GitHub Desktop.

Select an option

Save ochronus/8a827240b57556522cf9d1b1bdb01ad5 to your computer and use it in GitHub Desktop.
(defn gcd [a b] (if (zero? b) a (recur b (mod a b)))) ; greatest common divisor
(defn lcm [a b] (/ (* a b) (gcd a b))) ; lowest common multiple
(reduce #(lcm %1 %2) (range 1 21))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment