Brainsteem Compute #1 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]

in #mathematics7 years ago

This is a new contest in the Brainsteem family. I have noticed a lot of solutions to past problems are given using computational methods. So, just for you, a new series specifically designed to be solved computationally. You may also give analytical solutions as the early ones will be fairly simple.


The Question

If we list all the natural numbers below 20 that are multiples of 5 or 7, we get 5, 7, 10, 14 and 15. The sum of these multiples is 51.

Find the sum of all the multiples of 5 or 7 below 2000.

For the First Prize, please include a valid analytical or computational method.


Prizes

To qualify you must upvote this post and write the answer in a comment.

To win First Prize you must include the answer and a valid method.

The First Prize will be 40% of the earnings generated by this post, paid in SBD.

The Second Prize will be 10% of the earnings generated by this post, awarded to any other correct answer in the comments section, chosen at random and paid in SBD.

Also remember that your upvote generates curation rewards for you and that 25% of all earnings are given to upvoters.

Prizes will be awarded after the 7 days have expired. Winners will be announced in the comments below after the draw.

The Prizes will increase with more participation and as the earnings increase.

The main thing is to enjoy the challenge and maybe learn something new.


Come and check out other challenges currently live!

Brainsteem #8 Prize Maths Puzzle [Win 2SBD+1SBD]

Science Cryptic Crossword SCX1 [Win 10 SBD Prize]

Brainsteem #7 Prize Maths Puzzle [Win 2SBD+1SBD]

Brainsteem #6 Prize Maths Puzzle [Win 2SBD+1SBD]

Brainsteem #5 Prize Maths Puzzle [Win 2SBD+1SBD]


Please upvote, resteem and follow @rycharde for more Brainsteems!

And don't forget to upvote each other's comments to bring cheer to the whole community!

Sort:  

Don't forget to upvote each other's comments if they are good or correct - it's free cookies!
Your power comes back while you sleep! You can even upvote your own comments - turns power into a few cents, but it builds up.

OK, I've really drained my voting power with all the jobs I now do, so am upvoting at a small percentage for a few days :-(

I feel u.. 30% is really low lol

So, the sum of all the multiples of 5 below 2000. I made a table and figured out that for any x, the sum of the multiples of 5 = 5(1+2+3...(x/5 -1)). Therefore 5 * (1+2+3....399) gives us the sum of all the values of 5 under 2000. That equals 399000.

For the 7, it works the same 7(1+2+3...(x/7-1)). So 7 *( 1+2+3....284). So, (284/2) * 285 * 7 = 283290

So, 399000+283290=682990.

But shit, I've double counted all the multiples of 35.

So, sum of multiples of 35 under 2000 is
35 * (1+2+3....56). AKA 35 * 56 * 57/2 = 55890

So, subtract that out and 682990 - 55890 = 627100

I bet I forgot a zero or added a 7 somewhere. But re-steeming because I had a lot of fun trying.

So, I realized the x/5, x/7, x/35 had to be a whole number, but was wrong about having to round down. When rounded up, I get to the right answer. Close. But not playing horseshoes or hand grenades. Till next time.

td; dr: the answer is 626430

oops there is a /2 in the right side out of the picture lol

I'd like to give this a shot. beriberi's methodology is accurate but as they mentioned something was missing.

The sum of all positive integers from 1 to x is computed as x*(x+1)/2. This is the key component.

The multiples of 5 under 2000 go from 5 to 1995. Factoring out 5 yields 5*(1+2+...+399).
5 * [399 * 400 / 2] = 5 * 79800 = 399,000

The multiples of 7 under 2000 go from 7 to 1995. Factoring out 7 yields 7*(1+2+...+285).
7 * [285 * 286 / 2] = 7 * 40755 = 285,285

Multiples of 35 have thus been double-counted and need to be subtracted. Those go from 35 to 1995. Factoring out 35 yields 35*(1+2+...+57).
35 * [57 * 58 / 2] = 35 * 1653 = 57,855

The sum then is 399,000 + 285,285 - 57,855 = 626,430

same answer here with one small difference in the calculation:
To find for example the multiples of 5 below 2000, we notice the first is 5 and the last is 1995 and there are 399 such numbers. The first + the last = 5 + 1995 = 2000, so is the second + the second last = 10 + 1990 = 2000. This can be repeated 199 times and then we are left with 1000. So the sum is 199 x 2000 + 1000 = 399000.
The same can be done for 7 and 35, and the answer is 626430 as @doughtaker wrote.

I've coded mine in the programming language R. (Can't upload images in post)

Here is my code (and output):

> ## Rycharde's Challenge:
> 
> # Find the sum of all the multiples of 5 or 7 below 2000:
> 
> # Limiting number:
> 
> limit_number <- 2000
> 
> # Empty Vector:
> candidates <- c()
> 
> for (i in 1:(limit_number - 1)){
+   if (i %% 5 == 0 | i %% 7 == 0){
+     candidates <- c(candidates, i) # Append.
+   }
+ }
> 
> sum(candidates) # Print Total; 626430
[1] 626430

Many thanks!

Starting to come to a consensus answer.
Worth re-checking calculations.
More upvotes and more answers will increase the overall payout.
But this is also about learning a style of mathematics that rarely appears in textbooks, but is at the heart of maths challenges and competitions!

Thanks. upvoted!

!-=o0o=-!

To follow curated math content follow @math-trail.
If you wish @math-trail to follow you then read this article.

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 64118.79
ETH 3390.14
USDT 1.00
SBD 2.51