Writing a prime number function in Clojure

less than 1 minute read

Notes

(defn prime? [number]
 (every? false?
         (map #(= (mod number %) 0) (range 2 number))))

(prime? 21) ; false
(prime? 11) ; true

Updated: