Last active
August 29, 2015 14:22
-
-
Save tyamagu2/2ba70c79d7cece4e3a0b to your computer and use it in GitHub Desktop.
project_euler
This file contains hidden or 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
-- 1. Find the sum of all the multiples of 3 or 5 below 1000. | |
sum [ x | x <- [1..999], x `mod` 3 == 0 || x `mod` 5 == 0 ] | |
-- 2. By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. | |
let p2 = sum [ x | x <- takeWhile (< 4000000) fibs, even x] where fibs = 1 : 2 : zipWith (+) fibs (tail fibs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment