Skip to content

Instantly share code, notes, and snippets.

@tonyonodi
Created June 12, 2019 10:11
Show Gist options
  • Save tonyonodi/b77bd396e8c14161e6923b43c730913e to your computer and use it in GitHub Desktop.
Save tonyonodi/b77bd396e8c14161e6923b43c730913e to your computer and use it in GitHub Desktop.
{--
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