Created
July 22, 2010 03:55
-
-
Save Daenyth/485549 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
import IO | |
wanted :: (Integral a) => a -> Bool | |
wanted x | |
| mod 3 x == 0 = True | |
| mod 5 x == 0 = True | |
| otherwise = False | |
problem1 :: (Integral a) => a -> a | |
problem1 x = sum $ filter wanted [1 .. x] | |
main = do | |
let answer = show $ problem1 1000 in putStrLn answer | |
-- prints 9 :( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment