Hi,

While the code below solves the Euler problem #1 I was curious to explore the results for much higher limits. At 10,000,000 I run into heap exhaustion. in fn multiples-of-3-and-5-below-n everything is lazy seqs until the reduce, so I don’t understand why there would be a heap issue at all. I would understand an integer overflow, but not a heap issue.

Any ideas?

Thanks,

—Ralph

```
project-euler.core=> (multiples-of-3-or-5-below-n 10000000)
project-euler.core=> Exception in thread "nREPL-worker-8" java.lang.OutOfMemoryError: Java heap space
(ns project-euler.core)
(def natural-numbers
(iterate inc 1))
(defn multiple-of-n?
[n number]
(zero? (rem number n)))
(defn multiple-of-3-or-5?
[number]
(or (multiple-of-n? 3 number)
(multiple-of-n? 5 number)))
(defn multiples-of-3-and-5-below-n
[n]
(->> natural-numbers
(take (dec n))
(filter multiple-of-3-or-5?)
(reduce +)))
(defn -main
[]
(spit "answers.txt"
(str
(str "Problem 001: " (multiples-of-3-and-5-below-n 1000) "\n"))))
```