Skip to content

Instantly share code, notes, and snippets.

@paulmooring
Last active December 31, 2015 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulmooring/7993298 to your computer and use it in GitHub Desktop.
Save paulmooring/7993298 to your computer and use it in GitHub Desktop.
(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