You probably remember the sum formula for the first natural numbers
then in your example for calculating the sum of numbers between x and y we get:
Hi,
Sorry if this is in the wrong section, I did maths a year and a bit back in high school and im doing computing at uni, and I'm not sure on the exact formula I need.
I need it to double check that my program is outputting the right sum.
I need the formula to calculate the sum of the numbers between 200 and 300 inclusively.
the sum my program is giving me is 25250
I cant even remember doing this with numbers being inclusive or exclusive.
so could someone please explain the difference between inclusive and exclusive numbers, and the formula I need to be using?
thx
fantastic, so my program is outputting the correct answer! thx for the help much appreciated.
I do have another question or need another formula, I would like to remove the mutiples of 7.
from what I can remember this may have something to do with geometric or was it arithmatic sequences.
so the first multiples would be 203, 210, 217
and the difference between them is obviously 7,
so now I need to find the sum of the multiples of 7 between 2 numbers, so I can subtract it from my total of 25250
The multiples of 7 would range from 203 (7*29) through 294 (7*42). So, this sum would be
203 + 210 + 217 + ... + 294
which is the same as
7*29 + 7*30 + 7*31 + ... + 7*42
We can factor the 7 out, thus:
7*(29 + 30 + 31 + ... + 42)
So, if you can find the sum of the numbers between 29 and 42, and multiply that by 7, you will have calculated the sum of all the multiples of 7 between 200 and 300.
Of course you want to subtract this from your original answer.