# Multiples of three and five below n

I am tackling a problem which asks:

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

My reasoning is that since Since $\left\lfloor\frac{1000}{3}\right\rfloor = 333$ and $\left\lfloor\frac{1000}{5}\right\rfloor = 200$

This sum can be denoted as: $$\sum\limits_{n=1}^{333}3n + \sum\limits_{m=1}^{200} 5m = 3\sum\limits_{n=1}^{333}n + 5\sum\limits_{m=1}^{200} m$$ Using the identity $$\sum\limits_{i=1}^{n} i = \frac{n(n+1)}{2}$$ It can be solved analytically as $$3\sum\limits_{n=1}^{333}n + 5\sum\limits_{m=1}^{200} m = \frac{3}{2}(333(333+1)) + \frac{5}{2}(200(200+1)) = 267333$$

But apparently this is incorrect? Where did I go wrong in my reasoning?

## Edit

I tried to correct the double multiples with: $$3\sum\limits_{i=1}^{333}i + 5\sum\limits_{j=1}^{200}j - 15\sum\limits_{k=1}^{66} k = 234168$$

But this seems to be wrong as well...

## Edit 2:

GOT IT!

Up to and not including.

$$3\sum\limits_{i=1}^{333}i + 5\sum\limits_{j=1}^{199}j - 15\sum\limits_{k=1}^{66} k = 233168$$

Or, more ugly: $$3\sum\limits_{i=1}^{\left\lfloor\frac{999}{3}\right\rfloor}i + 5\sum\limits_{j=1}^{\left\lfloor\frac{999}{5}\right\rfloor}j - 15\sum\limits_{k=1}^{\left\lfloor\frac{999}{3\cdot 5}\right\rfloor} k = 233168$$

• You double-counted numbers that are multiples of both 3 and 5. Commented Dec 28, 2013 at 12:00
• "below" 1000 ro "up to including" 1000? And what is your control criterion to deem a result "apparently incorrect"? Commented Dec 28, 2013 at 12:13
• Shoot. Up to and not including. Commented Dec 28, 2013 at 12:22

Some numbers, such as $15$ and $30$, are multiples of both $3$ and $5$. These should be counted only once.
Edit: After comments to the question (not to this answer), I see that another issue is that you include $1000$ as the last term, but $1000$ is not below $1000$.
• Derp. So, should I subtract $\sum\limits_{k=1}^{\left\lfloor\frac{1000}{3*5}\right\rfloor} (5\times 3)k$ ? Commented Dec 28, 2013 at 12:02