Skip to content

Commit

Permalink
Found a cleaner way to create the masks for 51.
Browse files Browse the repository at this point in the history
  • Loading branch information
Darren Austin committed Aug 29, 2010
1 parent 43f9948 commit 32076b9
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/dma/euler/p051.clj
Expand Up @@ -5,10 +5,7 @@
(apply sorted-set (map str (take-between (exp 10 (dec n)) (exp 10 n) primes))))

(defn n-digit-masks [n]
(map #(let [m (Integer/toBinaryString %), ds (count m)]
(if (< ds n)
(concat (repeat (- n ds) \0) m)
m))
(map #(format (str "%" n "s") (Integer/toBinaryString %))
(range 1 (exp 2 n))))

(defn matches-mask? [ds mask]
Expand Down

0 comments on commit 32076b9

Please sign in to comment.