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.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Arvind has given the solution using code.We can also find the answer without writing a program.The numbers which are multiples of 3 and below 1000 are numbers in the sequence 3,6,9,......999 which turns out to be an AP whose sum comes out to be 166833.The numbers which are multiples of 5 and below 1000 are numbers in the sequence 5,10,15,......995 which again turns out to be an AP whose sum comes out to be 99500.It seems the answer should be 166833+99500=266333.But there is a problem both the sequences include numbers which are multiple of both 3 and 5.Such numbers are hence counted twice.So, to get the answer we find the sum of the sequence 15,30,45,.....990 which comes out to be 33165 and subtract it from 266333 to get 233168 as the final result.