Skip to content

Instantly share code, notes, and snippets.

@z-------------
Created July 25, 2019 12:40
Show Gist options
  • Save z-------------/376db5f4cbb55216737e793d056cb8cd to your computer and use it in GitHub Desktop.
Save z-------------/376db5f4cbb55216737e793d056cb8cd to your computer and use it in GitHub Desktop.
(defn is-prime? [n]
(reduce (fn [p x]
(if (== 0 (mod n x))
(reduced false)
p))
true
(range (int (/ n 2)) 1 -1)))
(println (take 100 (filter is-prime? (iterate inc 2))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment