Created
April 29, 2011 11:29
-
-
Save anonymous/948183 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
;; jneira's solution to http://4clojure.com/problem/67 | |
(fn primes [n] | |
(letfn | |
[(next-prime | |
[prs nxt] | |
(if (empty? (filter #(= 0 (mod nxt %)) prs)) | |
(conj prs nxt) | |
(recur prs (inc nxt))))] | |
(->> (iterate | |
(fn [prs] (next-prime prs (inc (last prs)))) [2]) | |
(take n) | |
(last)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment