Skip to content

Instantly share code, notes, and snippets.

@unforced
Last active August 29, 2015 14:09
Show Gist options
  • Select an option

  • Save unforced/5c5a4a82e2e9cf81f994 to your computer and use it in GitHub Desktop.

Select an option

Save unforced/5c5a4a82e2e9cf81f994 to your computer and use it in GitHub Desktop.
(defn fib [a b] (lazy-seq (cons a (fib b (+ a b)))))
(reduce + (filter even? (take-while #(< % 4000000) (fib 1 2))))
; Redacted problem 2 answer
(count (str (nth (fib (bigint 1) (bigint 2)) 400000)))
; 83596
(count (str (nth (fib (bigint 1) (bigint 2)) 4000000)))
; 835951
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment