Skip to content

Instantly share code, notes, and snippets.

@fumokmm
Created May 19, 2012 05:03
Show Gist options
  • Save fumokmm/2729276 to your computer and use it in GitHub Desktop.
Save fumokmm/2729276 to your computer and use it in GitHub Desktop.
エラトステネスの篩を使ってClojureで素数を求める
(defn sieve [nums]
(filter #(not= 0 (rem % (first nums))) (rest nums)))
(defn primes []
(map first
(iterate sieve (iterate inc 2))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment