Created
July 4, 2016 14:30
-
-
Save Anderssorby/c768ac48a54a1fca32ecbbc99783432c 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
;; A prime finder (not optimized) | |
(fn [s] (loop [i s p [] n 2] | |
(cond | |
(= 0 i) p | |
(every? identity (map #(not= 0 (mod n %)) p)) (recur (dec i) (conj p n) (inc n)) | |
:else (recur i p (inc n))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment