Project Euler Problem 40

Ivar Thorson bio photo By Ivar Thorson

This one was too easy to brute force.

(defn euler-40 []
  (let [d (apply concat (map str (iterate inc 0)))]
    (reduce * (map #(Character/getNumericValue (nth d %))
                   [1 10 100 1000 10000 100000 1000000]))))

It appears that people on clojure-euler studied the problem a bit more to algorithmically extract the desired digits without having to look at intervening digits, but I think I will just leave this one alone. The above brute force approach only takes 1.5 seconds on my computer, and programmer time is more valuable than machine time to me today.