Skip to content

Instantly share code, notes, and snippets.

@kohyama
Created September 28, 2015 05:55
Show Gist options
  • Save kohyama/8e599b2e765ad4256f32 to your computer and use it in GitHub Desktop.
Save kohyama/8e599b2e765ad4256f32 to your computer and use it in GitHub Desktop.
Prime numbers in Clojure
(def prime-numbers
((fn f [x]
(cons x
(lazy-seq
(f (first
(drop-while
(fn [n]
(some #(zero? (mod n %))
(take-while #(<= (* % %) n) prime-numbers)))
(iterate inc (inc x))))))))
2))
@EliasGit2017
Copy link

Thank you.
It's really helping me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment