Skip to content

Instantly share code, notes, and snippets.

@Anderssorby
Created July 4, 2016 14:30
Show Gist options
  • Save Anderssorby/c768ac48a54a1fca32ecbbc99783432c to your computer and use it in GitHub Desktop.
Save Anderssorby/c768ac48a54a1fca32ecbbc99783432c to your computer and use it in GitHub Desktop.
;; A prime finder (not optimized)
(fn [s] (loop [i s p [] n 2]
(cond
(= 0 i) p
(every? identity (map #(not= 0 (mod n %)) p)) (recur (dec i) (conj p n) (inc n))
:else (recur i p (inc n)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment