From 2717476a96a0e3015191b3d80cb247164da807bd Mon Sep 17 00:00:00 2001 From: Lowl3v3l Date: Fri, 15 Dec 2017 18:17:11 +0100 Subject: [PATCH] haskell solutions for 1 and 2 --- e0001/euler0001.hs | 5 +++++ e0002/euler0002.hs | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 e0001/euler0001.hs create mode 100644 e0002/euler0002.hs diff --git a/e0001/euler0001.hs b/e0001/euler0001.hs new file mode 100644 index 0000000..9f7247a --- /dev/null +++ b/e0001/euler0001.hs @@ -0,0 +1,5 @@ +main :: IO() +main = do + print (sum multiples) + where + multiples = [x | x <- [3..999], (mod x 3 == 0) || (mod x 5 == 0)] diff --git a/e0002/euler0002.hs b/e0002/euler0002.hs new file mode 100644 index 0000000..16bac15 --- /dev/null +++ b/e0002/euler0002.hs @@ -0,0 +1,6 @@ +main :: IO() +main = do + print (sum ret) + where + fibs = 1 : 2 : zipWith (+) fibs (tail fibs) + ret = filter even (takeWhile (<= 4000000) fibs)