Created
October 15, 2015 17:40
-
-
Save mzemel/fd9f7ae98d31b02e4596 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 clojure-euler.core | |
(:gen-class)) | |
(defn -main | |
[& args] | |
) | |
; 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 first_problem | |
[] | |
(loop [iteration 1 numbers []] | |
(if (> 1000 iteration) | |
(do | |
(if (or (= (mod iteration 3) 0) (= (mod iteration 5) 0)) | |
(recur (inc iteration) (conj numbers iteration)) | |
(recur (inc iteration) numbers))) | |
(do | |
(println (reduce + numbers)) | |
(println iteration))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment