Jacob’s little brother bragged that he could add all numbers from from 1 to 10 (55).Not to be outdone, Jacob said he could add all numbers from 1 to 100 (the answer is 5050).Perhaps because Jacob was a bit too smuck about it, Jacob’s little brother gave him a challenge — can you add all numbers from 1 to 99, but excluding all multiples of 2 or 3?
Suppose we begin by looking at the first 6 numbers. The only numbers that are not divisible by 2 or 3 are 1 and 5.
Now, you can note that since 6 is divisible by both 2 and 3, this pattern will continue.
The sum of 1 and 5 is 6. Generalizing this, we can say that the sum of the numbers not divisible by 2 or 3 in the xth group of 6 is 12x - 6. This is obtained by the fact that each number increases by six when moving up a group of 6.
Now we check how many full groups of six there are from 1 to 99. This gives a result of 16. Therefore, we evaluate \(\sum_{n = 1} ^ {12} 12n - 6\) and get a result of 864. But there is one number we are forgetting: 97, which is greater than 96 and thus not included in our sum. Finally, we add 97 to get our final result of 961.