0
$\begingroup$

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: \begin{equation} \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 \end{equation} 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$$

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

2 Answers 2

2
$\begingroup$

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

$\endgroup$
2
  • 1
    $\begingroup$ Derp. So, should I subtract $ \sum\limits_{k=1}^{\left\lfloor\frac{1000}{3*5}\right\rfloor} (5\times 3)k$ ? $\endgroup$ Commented Dec 28, 2013 at 12:02
  • $\begingroup$ @NictraSavios Sounds correct. $\endgroup$ Commented Dec 28, 2013 at 12:03
1
$\begingroup$

you double added all the multiples of 15

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .