Problem 1
05 October 2001
If we list all the naturalnumbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum ofthese multiples is 23.
Find the sum of all the multiplesof 3 or 5 below 1000.
Answer on 2009-2-15
Haskell:
sum [n | n<-[1..1000-1],mod n 5 == 0 || mod n 3 == 0]
Mathematica:★★★★★
Plus@@ Select[Range[999],Mod[#,3]==0||Mod[#,5]==0&]
233168