Skip to content

Instantly share code, notes, and snippets.

@paulspencerwilliams
Created November 22, 2015 12:19
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 paulspencerwilliams/9a5587d9826d1a6e5f94 to your computer and use it in GitHub Desktop.
Save paulspencerwilliams/9a5587d9826d1a6e5f94 to your computer and use it in GitHub Desktop.
(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