Wednesday, February 24, 2010

Project Euler Problem 25

Lau Jensen had put up another nice post. I am sure it was just for fun, and not really, really comparing all the three languages.

Anyways heres my solution to the same Euler Problem no. 25
# Project Euler Problem 25
# What is the first term in the Fibonacci sequence to contain 1000 digits?
(def fibs (map second (iterate (fn [[a b]] [b (+ a b)]) [0 1])))
(let [limit (.pow (BigInteger/TEN) 999)]
(count (take-while #(< % limit) fibs)))
view raw gistfile1.clj hosted with ❤ by GitHub

No comments: