7
$\begingroup$

What is the sum of all the natural numbers between $500$ and $1000$ (extremes included) that are multiples of $2$ but not of $7$?

$\endgroup$
3
5
$\begingroup$

In general, the sum of an arithmetic progression is $$S_n = \sum_{i=1}^{n} a_i=\frac{n}{2}(a_1+a_n)$$

So, the sum of all even numbers in your interval

$$ = \frac{251}{2}(500+1000)$$

And the sum of all multiples of $14$ in your interval $$ = \frac{36}{2}(504+994)$$

Subtracting these two answers will give you the result you are looking for.

$\endgroup$
3
  • $\begingroup$ 188250 - 26964 = 161286 @Cm7F7Bb got 149536 $\endgroup$ – RafaSashi Feb 11 '16 at 13:03
  • 2
    $\begingroup$ I've checked mine in python, it's correct. $\endgroup$ – fosho Feb 11 '16 at 13:06
  • 1
    $\begingroup$ I get it! Thanks for answer and explanations. $\endgroup$ – RafaSashi Feb 11 '16 at 13:08
2
$\begingroup$

\begin{align*} \sum_{i=0}^{250}(500+2i)-\sum_{i=0}^{35}(504+14i) &=251\cdot500+2\sum_{i=0}^{250}i-36\cdot504-14\sum_{i=0}^{35}i\\ &=251\cdot500+2\biggl[\frac{251(0+250)}2\biggr]-36\cdot504-14\biggl[\frac{36(0+35)}2\biggr]\\ &=161286 \end{align*} using the arithmetic progression formula (see here).

$\endgroup$
1
  • 1
    $\begingroup$ +1 for the correction and progression formula. The acceptance belongs to @Daniel Thanks both! $\endgroup$ – RafaSashi Feb 11 '16 at 13:10
0
$\begingroup$

hint1: for divisibility by 2 find the sum of arithmetic numbers of distance2

hint2: Numbers divisible of 7 are either multiples of 14 or divisible by 14 when added 7, so try to subtract sequence of difference 14 from your sum

$\endgroup$
0
$\begingroup$

Heres a code solution using a C# console application:

// hold all numbers to be summed 

List<int> multiplesOfTwoCollection = new List<int>();<br>

// count numbers 

for (int naturalNumber = 500; naturalNumber <= 1000; naturalNumber++)

{ if (naturalNumber % 2 == 0) { multiplesOfTwoCollection.Add(naturalNumber); }

// log contents

 Console.WriteLine("natural number:{0}", naturalNumber); }

// multiples of 7

int sumOfInts = 0;
foreach (var item in multiplesOfTwoCollection)
 if (item % 7 == 0) { Console.WriteLine("multiple of 7:{0}", item);
     } else { sumOfInts += item; }

Console.WriteLine("sum of numbers between 500 and 1000 that are multiples of 2 not 7:{0}", sumOfInts);

Returns

161286

$\endgroup$
2
  • 1
    $\begingroup$ You should at least format your post so that it is more readable, please. $\endgroup$ – Watson Feb 18 '16 at 12:34
  • 1
    $\begingroup$ yes i apologize, it was awful wasnt it. i have reformatted. $\endgroup$ – Mark Emerson 28DaysIELTS Feb 18 '16 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.