Skip to content

Commit

Permalink
Adding Euler 32
Browse files Browse the repository at this point in the history
  • Loading branch information
Istvan committed Sep 12, 2012
1 parent e0abcca commit 4ea90e1
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/euler/core.clj
Expand Up @@ -142,15 +142,21 @@
[n]
(map char-int (str n)))

(defn multipl []
(for
[a (range 1 999)
b (range 1 999)]
[a b (* a b)]))

(defn asd [] )

(defn pandigital?
[x y z]
(= '(1 2 3 4 5 6 7 8 9)
(sort (apply concat (map digits [x y z])))))

(defn euler32
[]
(reduce + (distinct (for
;the tricky part is to skip
;the already calculated values, reduces runtime
[a (range 1 5000)
b (range a (/ 9999 a))
:let [c (* a b)]
:when (pandigital? a b c)]
c))))

(ns maps-as-we-like)

Expand Down

0 comments on commit 4ea90e1

Please sign in to comment.