Skip to content

Commit

Permalink
Merge pull request #89 from FrankKair/Clojure-problem-007
Browse files Browse the repository at this point in the history
Feat: Adds Clojure 007
  • Loading branch information
FrankKair authored Jun 14, 2018
2 parents e43606f + f77de4c commit 81cac22
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/007/p007.cljc
Original file line number Diff line number Diff line change
@@ -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))

0 comments on commit 81cac22

Please sign in to comment.