Skip to content

Commit

Permalink
Solve #32 in Haskell.
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharydenton committed May 18, 2014
1 parent 4fcb599 commit cd162de
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions 032/pandigital.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Data.List (nub, sort)

candidates :: [(String, Integer)]
candidates = [(concatMap show [a, b, a*b], a*b) | a <- [1..2000], b <- [1..50]]

pandigital :: String -> Bool
pandigital = (== "123456789") . sort

main :: IO ()
main = print $ sum $ nub [p | (digits, p) <- candidates, pandigital digits]

0 comments on commit cd162de

Please sign in to comment.