Project Euler in Clojure – Problem 1

In trying to learn Clojure and wrap my head around good functional programming, and hoping to learn more idiomatic Clojure, I have started working through the Project Euler problems. In doing this, I have also setup a repository on to keep track of my progress, which can be found at

Problem 1 of Project Euler is described as:

Add all the natural numbers below one thousand that are multiples of 3 or 5.

The solution I came up with is:

(defn problem1 []
  (reduce + (filter #(or (zero? (rem % 3)) (zero? (rem % 5))) (range 1000))))

I take the range of all numbers from 1 to 999, filter out those numbers evenly divisible by 3 or 5, and then reduce/apply the addition operator to that sequence of numbers.

I would love comments and suggestions on my solution to this problem, and if there are tweaks to make it more Clojure-ish.

Here is my approach to Problem 2 in Clojure.


2 thoughts on “Project Euler in Clojure – Problem 1

  1. Pingback: Project Euler in Clojure – Problem 2 « Proctor It

  2. Pingback: Clojure function has-factors-in? « Proctor It

Leave a Reply

Your email address will not be published. Required fields are marked *