Last active
December 31, 2015 13:29
-
-
Save paulmooring/7993298 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
(defn pe_1 | |
"Returns the sum of all numbers below [x] that are multiples of 3 or 5" | |
[x] | |
(pe_1_acc x 0)) | |
(defn pe_1_acc [x acc] | |
(cond | |
(= x 0) acc | |
(or (= 0 (rem x 3)) (= 0 (rem x 5))) (pe_1_acc (dec x) (+ acc x)) | |
:else (pe_1_acc (dec x) acc))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment