one-file-projects/primefactors.clj

13 lines
No EOL
170 B
Clojure

(defn factors [x]
(if (== x 1)
'()
(let [f
(first
(filter (fn [e] (zero? (mod x e)))
(range 2 (+ x 1))
)
)]
(conj (factors (/ x f)) f)
)
)
)