diff --git a/src/007/p007.cljc b/src/007/p007.cljc new file mode 100644 index 0000000..35a6e68 --- /dev/null +++ b/src/007/p007.cljc @@ -0,0 +1,17 @@ +; works in both clojure and clojurescript + +(defn next-primes [[primes new]] + (let [new* (inc (inc new))] + (if (some #(= 0 (rem new %)) primes) + [primes new*] + [(conj primes new) new*]))) + +(defn solve [] + (let [primes (->> [[2] 3] + (iterate next-primes) + (map first) + dedupe + (map peek))] + (first (drop 10000 primes)))) + +(prn (solve)) \ No newline at end of file