Finding primes from 1 to 100 in Clojure

less than 1 minute read

Notes

;; prime.clj

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

(load-file "prime.clj")

(defn return-number-if-prime [number]
  (when (prime? number) number))

(remove nil?
 (map #(return-number-if-prime %) (range 1 101)))

Updated: