Advertisement
banovski

Project Euler, Problem #1, Haskell

Nov 27th, 2021 (edited)
1,842
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- If we list all the natural numbers below 10 that are multiples of 3
  2. -- or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find
  3. -- the sum of all the multiples of 3 or 5 below 1000.
  4.  
  5. main :: IO ()
  6. main = print $ sum [x | x <- [0 .. 999], mod x 3 == 0 || mod x 5 == 0]
  7.  
  8. -- 233168
  9.  
  10. -- real 0m0,004s
  11. -- user 0m0,000s
  12. -- sys  0m0,003s
  13.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement