haskell solutions for 1 and 2
This commit is contained in:
parent
73b494e207
commit
2717476a96
2 changed files with 11 additions and 0 deletions
5
e0001/euler0001.hs
Normal file
5
e0001/euler0001.hs
Normal file
|
@ -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)]
|
6
e0002/euler0002.hs
Normal file
6
e0002/euler0002.hs
Normal file
|
@ -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)
|
Reference in a new issue