Skip to content

Instantly share code, notes, and snippets.

@ranjanprj
Created May 4, 2017 10:40
Show Gist options
  • Save ranjanprj/90fcce2f1aa04ffc4730c2c6ef8ca278 to your computer and use it in GitHub Desktop.
Save ranjanprj/90fcce2f1aa04ffc4730c2c6ef8ca278 to your computer and use it in GitHub Desktop.
(ns euler.core)
;; If we list all the natural numbers below 10 that are multiples of 3 or 5,
;; we get 3, 5, 6 and 9. The sum of these multiples is 23.
;; Find the sum of all the multiples of 3 or 5 below 1000.
(defn p1
[n]
(if (or(= 0 (mod n 3)) (= 0 (mod n 5)) )
true
false))
(defn m35
[numbers]
(if-let [mul-nums (seq(filter p1 numbers))]
mul-nums
"no numbers"))
(reduce +(m35 (range 1 1000)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment