Created
June 12, 2019 10:11
-
-
Save tonyonodi/b77bd396e8c14161e6923b43c730913e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-- | |
By considering the terms in the Fibonacci sequence whose values do not exceed four million, | |
find the sum of the even-valued terms. | |
--} | |
let fib = 1 : 2 : zipWith (+) fib (tail fib) | |
foldr (+) 0 $ filter even $ takeWhile (< 4e6) fib |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment