Skip to content

Instantly share code, notes, and snippets.

@bretkoppel
Last active December 21, 2015 05:39
Show Gist options
  • Save bretkoppel/6258756 to your computer and use it in GitHub Desktop.
Save bretkoppel/6258756 to your computer and use it in GitHub Desktop.
Clojure solution to Project Euler problem 2.
(defn fib-even []
(loop [x 0, y 1, acc 0]
(let [term (+ x y)]
(if (< y 4000000)
(recur y term (if (even? term) (+ acc term) acc))
acc))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment