Guest User

euler1

a guest
Apr 24th, 2012
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. multipleOf :: (Integral a) => a -> a -> Bool
  2. multipleOf x y
  3.        | mod x y == 0   = True
  4.        | otherwise      = False
  5.  
  6. sumOfList :: (Num a) => [a] -> a
  7. sumOfList = foldl (+) 0
  8.  
  9. --| Find the sum of all integers under 1000 that are divisible by 3 or 5.
  10. euler1 = sumOfList $ filter (\x -> x `multipleOf` 3 || x `multipleOf` 5) [999,998..0]
Advertisement
Add Comment
Please, Sign In to add comment