LoginSignup
1
0

More than 5 years have passed since last update.

Project Euler/problem 1

Posted at

problem 1

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.


problem1.hs
main = print $ sum [x|x<-[1..999], x `mod` 3 == 0 || x `mod` 5 ==0]
answer
233168
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0