Created
July 27, 2010 16:11
-
-
Save sleepynate/492433 to your computer and use it in GitHub Desktop.
This file contains 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
; Project Euler Problem 1 | |
; | |
; 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. | |
; | |
; solution by nathan dotz | |
; nathan (period) dotz (at sign) gmail (period) com | |
(ns euler1) | |
(defn divBy? | |
"See if this is number is evenly divisble by divisor" | |
[number divisor] | |
(= 0 (mod number divisor)) | |
) | |
(defn fizzBuzz? | |
"check to see if number is divisible by 3 or 5" | |
[number] | |
(or (divBy? number 3) (divBy? number 5)) | |
) | |
(def fizzbuzzd | |
(filter fizzBuzz? (range 1 1000)) | |
) | |
(print (reduce + fizzbuzzd)) |
Author
sleepynate
commented
Jul 27, 2010
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment