Project Euler Problem 10

Ivar Thorson bio photo By Ivar Thorson

All that work we did back in problem 7 really paid off for this problem. If we use the lazy prime generating functions we defined earlier, problem 10 has become a one-liner.

(defn euler-10 [] (reduce + (take-while #(> 2000000 %) (lazy-primes-cgrande))))

Speaking of lazy lists, I’m off to go wait in front of a vending machine on my coffee break.