Results 1 to 10 of 10

Math Help - [SOLVED] Sum of numbers between 2 numbers, formula?

  1. #1
    Junior Member
    Joined
    Oct 2007
    Posts
    32

    Question [SOLVED] Sum of numbers between 2 numbers, formula?

    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
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Newbie
    Joined
    May 2009
    Posts
    9
    Thanks
    1
    You probably remember the sum formula for the first natural numbers

    \frac{n(n+1)}{2} then in your example for calculating the sum of numbers between x and y we get:


    S(x,y) \, = \, \frac{x(x+1)}{2} - \frac{y(y+1)}{2} \qquad x>y
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Junior Member
    Joined
    Oct 2007
    Posts
    32
    so with this formula is it calculating like

    201 + 202.... +299
    or
    200+201... +300

    thx
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Newbie
    Joined
    May 2009
    Posts
    9
    Thanks
    1
    Seems like i made some slight mistake in my previous solution, the correct should be

    S(x,y) \, = \, \frac{x(x+1)}{2} \, - \, \frac{y(y-1)}{2} \qquad x>y

    Lets say S(204,200) this should be equal to

    200 + 201 + 202 + 203 + 204 = 1010

    Which indeed this formula gives us.

    S(300,200)=25250
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Junior Member
    Joined
    Oct 2007
    Posts
    32
    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
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Senior Member
    Joined
    Jan 2010
    Posts
    354
    Quote Originally Posted by KavX View Post
    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.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Junior Member
    Joined
    Oct 2007
    Posts
    32
    thx for the help again, just to double check if im doing this right

    would my answer be 3276?

    i got 468 when finding the sum between those 2 numbers, after multiplying by 7 i got 3276
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Newbie
    Joined
    May 2009
    Posts
    9
    Thanks
    1
    \sum\limits_{n = y}^m {7n}  =  - \frac{{7\left( {y - x + 1} \right)\left( {y + x} \right)}}{2}

    S(x,y) = 25250 + \frac{{7\left( {y - x + 1} \right)\left( {y + x} \right)}}{2} \qquad x>y

    Enjoy
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Junior Member
    Joined
    Oct 2007
    Posts
    32
    using your formula Nebuchadnezzar, i get 3479 as the sum of the multiplys of 7

    so 25250 -3479 = 21771

    are those correct?
    thx for the help
    Follow Math Help Forum on Facebook and Google+

  10. #10
    Senior Member
    Joined
    Jan 2010
    Posts
    354
    Quote Originally Posted by KavX View Post
    thx for the help again, just to double check if im doing this right

    would my answer be 3276?

    i got 468 when finding the sum between those 2 numbers, after multiplying by 7 i got 3276
    A quick an easy way to find the sum of all integers in a given range is to multiply the average of the first and last term by the number of terms.

    So, in this case:

    \frac{29+42}{2} \cdot 14 = 497
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 2
    Last Post: June 29th 2011, 10:15 AM
  2. finding the formula for a sequence of numbers
    Posted in the Calculus Forum
    Replies: 2
    Last Post: February 24th 2011, 08:47 PM
  3. Formula for a game of combinations of numbers...
    Posted in the Advanced Statistics Forum
    Replies: 0
    Last Post: October 28th 2008, 07:37 AM
  4. Formula for sum of squared odd numbers.
    Posted in the Math Topics Forum
    Replies: 4
    Last Post: August 14th 2008, 06:07 AM
  5. Pentagonal Numbers Formula
    Posted in the Algebra Forum
    Replies: 4
    Last Post: April 30th 2007, 06:07 AM

Search Tags


/mathhelpforum @mathhelpforum