summaryrefslogtreecommitdiff
path: root/haskell/p4.hs
diff options
context:
space:
mode:
authorGuillermo Ramos2013-05-27 10:31:48 +0200
committerGuillermo Ramos2013-05-27 10:31:48 +0200
commit317ee36636ebeec986971ef857cd297f0320e58d (patch)
tree88c10fdbf166beae22f6c9d6c79970ae2240f4b0 /haskell/p4.hs
downloadeuler-317ee36636ebeec986971ef857cd297f0320e58d.tar.gz
start
Diffstat (limited to 'haskell/p4.hs')
-rw-r--r--haskell/p4.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/haskell/p4.hs b/haskell/p4.hs
new file mode 100644
index 0000000..2670bd5
--- /dev/null
+++ b/haskell/p4.hs
@@ -0,0 +1,7 @@
+palindrome :: (Integral a) => a -> Bool
+palindrome n = let ns = show n in ns == reverse ns
+
+p4 :: Int
+p4 = maximum $ filter palindrome [x*y | x <- [100..999], y <- [100..999]]
+
+main = putStrLn $ "Solution: " ++ show p4