Skip to content

Commit

Permalink
Solution for #47.
Browse files Browse the repository at this point in the history
  • Loading branch information
rjray committed Feb 4, 2016
1 parent 6dfe0ea commit 79ca9f9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/projecteuler/p047.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(ns projecteuler.core
(:require [projecteuler.core :refer [factorize]]))

;; https://projecteuler.net/problem=47

(defn- distinct-prime-factors [n]
(distinct (factorize n)))

(defn distinct-primes-factors-chain [l]
(let [l (or l 4)]
(loop [n 2, lst ()]
(cond
(= l (count lst))
(reverse lst)
(= l (count (distinct-prime-factors n)))
(recur (inc n) (cons n lst))
:else
(recur (inc n) ())))))

0 comments on commit 79ca9f9

Please sign in to comment.