From 317ee36636ebeec986971ef857cd297f0320e58d Mon Sep 17 00:00:00 2001 From: Guillermo Ramos Date: Mon, 27 May 2013 10:31:48 +0200 Subject: start --- haskell/p2.hs | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 haskell/p2.hs (limited to 'haskell/p2.hs') diff --git a/haskell/p2.hs b/haskell/p2.hs new file mode 100644 index 0000000..1d9d769 --- /dev/null +++ b/haskell/p2.hs @@ -0,0 +1,8 @@ +fibs :: [Int] +fibs = list + where list = 0 : 1 : zipWith (+) list (tail list) + +p2 :: Int +p2 = sum [x | x <- takeWhile (< 4000000) fibs, mod x 2 == 0] + +main = putStrLn $ "Solution: " ++ show p2 -- cgit v1.2.3