Project Euler #1: Multiples of 3 and 5

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 N.

We know that multiples of 3 form an arithmetic sequence as

3, 6, 9, 12, 15, 18… (1)

Similarly multiples of 5 form an arithmetic sequence as

5, 10, 15, 20… (2)

Sum (1) and (2) we get

3, 5, 6, 9, 12, 15, 15, 18, 20

You’ll notice that 15 is repeated. In fact all the multiples of 15 or 5*3 are repeated because it got counted twice once in the series of 3 and again in the series of 5. Hence we’ll subtract the series of 15

Our final answer will be

Sum(3) + Sum(5) — Sum(15)