Skip to content

Instantly share code, notes, and snippets.

@MAGANER
Created December 29, 2022 14:48
Show Gist options
  • Save MAGANER/6ab1f6ffc485738be90945920d420923 to your computer and use it in GitHub Desktop.
Save MAGANER/6ab1f6ffc485738be90945920d420923 to your computer and use it in GitHub Desktop.
first task solution from https://projecteuler.net in haskell
{-
#1 task from https://projecteuler.net/archives
Find the sum of all the multiples of 3 or 5 below 1000.
-}
mult::Int -> Bool
mult x = x `mod` 5 == 0 || x `mod` 3 == 0
filter_seq::[Int] -> [Int]
filter_seq seq = [x | x <- seq, mult x ]
main::IO()
main = print (sum $ filter_seq [0..999])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment