(ns prime.clj
  (:gen-class))

(require '[clojure.math.numeric-tower :as math])

(defn prime? [x]
  (cond
    (integer? (math/sqrt x)) false
    :else (every?
            (fn [y] (not= (mod x y) 0))
            (range 2 (math/ceil (math/sqrt x))))))


(defn -main
  [& args]
  (def v [])
  (def i 0)
  (while (< (count v) (Integer/parseInt (first args)))
    (cond (prime? i) (def v (conj v i)))
    (def i (inc i)))
  (println v))

(ns prime.clj
  (:gen-class))

(require '[clojure.math.numeric-tower :as math])

(defn prime? [x]
  (if
    (integer? (math/sqrt x)) false
    (every?
       (fn [y] (not= (mod x y) 0))
       (range 2 (math/ceil (math/sqrt x))))))


(defn -main
  [& args]
  (def v [])
  (def i 0)
  (while (< (count v) (Integer/parseInt (first args)))
    (cond (prime? i) (def v (conj v i)))
    (def i (inc i)))
  (println v))

Replace cond with if for shorter, clearer code.
Replace cond with if for shorter, clearer code.

noamknispel/ThePrimeBenchMark,noamknispel/ThePrimeBenchMark,noamknispel/ThePrimeBenchMark,noamknispel/ThePrimeBenchMark,noamknispel/ThePrimeBenchMark