-
-
Save paulspencerwilliams/9a5587d9826d1a6e5f94 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
(defn primes | |
[possibles] | |
(loop [previous-primes [] | |
current-prime 2 | |
possibles possibles] | |
(println (str (pr-str previous-primes) ":" current-prime ":" (pr-str (take 20 possibles))) ) | |
(if (= -1 (compare current-prime 775147)) | |
(recur | |
(conj previous-primes current-prime) | |
(first possibles) | |
(filter | |
(fn [x] | |
(not | |
(zero? | |
(rem x current-prime)))) | |
(rest possibles))) | |
previous-primes))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment