sumEvenFib :: Integer -> Integer
sumEvenFib x = sum . takeWhile (<x) . filter even $ fibs
where fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
main :: IO ()
main = print $ sumEvenFib 4000000
We’re a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.