We had already discussed earlier in the day that there is an equation to give you the sum, but in the spirit of all following the same approach, I won't be using it.
The plan is for everyone to post the implementation in their blog, so without further delay, here is mine:
The plan is for everyone to post the implementation in their blog, so without further delay, here is mine:
sum [n | n <- [1..999], mod n 3 == 0 || mod n 5 == 0 ]]
2 comments:
Would the sum function take care of overlapping multiples? For instance both 3
and 5's multiples merge at 15, 30, 45 etc.
It wont add twice if thats what you are asking, since it adds if n mod 5 = 0 or n mod 3 = 0.
Post a Comment