Skip to content

Instantly share code, notes, and snippets.

@LVMBDV
Created February 23, 2018 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LVMBDV/585e93ac790e83acf23966b54de34551 to your computer and use it in GitHub Desktop.
Save LVMBDV/585e93ac790e83acf23966b54de34551 to your computer and use it in GitHub Desktop.
(defn fib
([] (fib 1 1)) ; start with x = y = 1
([x y] (lazy-seq (cons x (fib y (+ x y)))))) ; x = y and y = x + y
(println (reduce + (filter even?
(take-while #(< % 4000000) (fib)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment