From 865937a152c704fe60623c8734e801e8bcc41ae9 Mon Sep 17 00:00:00 2001 From: Amneesh Singh Date: Wed, 26 Oct 2022 12:49:33 +0530 Subject: [PATCH] haskell: add p1, p2 Signed-off-by: Amneesh Singh --- haskell/p1.hs | 5 +++++ haskell/p2.hs | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 haskell/p1.hs create mode 100644 haskell/p2.hs diff --git a/haskell/p1.hs b/haskell/p1.hs new file mode 100644 index 0000000..b49f82f --- /dev/null +++ b/haskell/p1.hs @@ -0,0 +1,5 @@ +main :: IO () +main = putStr $ show solve + +solve :: Integer +solve = sum [ x | x <- [0..999], mod x 3 == 0 || mod x 5 == 0 ] diff --git a/haskell/p2.hs b/haskell/p2.hs new file mode 100644 index 0000000..346e513 --- /dev/null +++ b/haskell/p2.hs @@ -0,0 +1,7 @@ +import Lib (fib) + +main :: IO () +main = putStr $ show solve + +solve :: Integer +solve = sum $ filter even $ takeWhile (<= 4000000) fib