You are viewing a single comment's thread from:
RE: Brainsteem Compute #1 Prize Computational Maths Puzzle [Win 40% and 10% in SBD]
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.