Created
July 25, 2019 12:40
-
-
Save z-------------/376db5f4cbb55216737e793d056cb8cd 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 is-prime? [n] | |
(reduce (fn [p x] | |
(if (== 0 (mod n x)) | |
(reduced false) | |
p)) | |
true | |
(range (int (/ n 2)) 1 -1))) | |
(println (take 100 (filter is-prime? (iterate inc 2)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment