Created
May 4, 2017 10:40
-
-
Save ranjanprj/90fcce2f1aa04ffc4730c2c6ef8ca278 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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