Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Add the numbers from 1 to 100

  1. Feb 1, 2008 #1
    Hey, I've been trying to work this out for a few days now. There is supposed to be an easy way to add all the numbers from 1 to 100 easily, anyone know?
  2. jcsd
  3. Feb 1, 2008 #2
    I would venture to say that almost anyone on this forum knows how to sum an arithmetic progression. But here's a tip that doesn't call on much more than arithmetic. Consider adding the numbers from 1 to 100 twice. By cleverly arranging the addition like so

    1 + 2 + 3 + 4 .... + 100 +
    100 + 99 + 98 + 97 ... + 1

    what constant relationship do you see between two numbers of the same column?
  4. Feb 1, 2008 #3
    I think that the easy way is:

    1+2+3+...+100=x (1)
    100+99+98+...+1=x (2)

    combine this two (1)+(2)

  5. Feb 1, 2008 #4
    Brilliant cheers. I thought it had something to do with that but I struggled to put it into a formula.
  6. Feb 1, 2008 #5
    I like to match up 100 with 0 myself, and you get all the way down to:
    99+1, ... 51+49, then 50. So 100*50 + 50.
  7. Feb 10, 2008 #6
    There is another way to visualize this using square arrays of elements. In a square array that is m=n+1 elements on a side, the number of off-diagonal elements in the lower left (or upper right) is (m^2-m)/2. But this is also the sum of the number of elements in all of the rows in that part of the matrix: 1+2+3+...+n. In our case n=100, m=101 and (m^2-m)/2=5050. This is equivalent to the Werg22 and Curvation solution.

    To get K.J.Healey's solution, note that if we subtract half of the off-diagonal elements (say the upper right) in an nxn array then the remaining number of elements is n^2-(n^2-n)/2=(n^2+n)/2, again the sum of rows is 1+2+3+...+n. But this is n*(n/2)+(n/2) and is equal to 100*50+50 in our case.

    Putting m=n+1 into (m^2-m)/2 gives (n^2+n)/2, so the two array visualizations are equivalent, of course.
  8. Feb 13, 2008 #7
    I know how to do this but how would you do it if it weren't just intigers like 1 to n. What if you wanted to add 1+1/n where n = a positive intiger? lets say where n is 1 to 100
  9. Feb 21, 2008 #8
    99+1 98+2 97+3 etc... 100+0 you take half of the number, and multiply it by 100, then add the number (5050)

    1000*500+500= 500500 etc.
  10. Mar 2, 2008 #9
    It's easy to see why this works if you represent each number as a total of individual numbers.



    And so on, what do you notice about the ratio of 0's to 1's.

    Incidentally there's a famous story where Gauss was asked this in a maths class at the age of 7, thinking to stump the children; Gauss gave him an immediate answer, something like the above answers given by the others, by figuring the above simple relation.
  11. Mar 3, 2008 #10
    You are all geniuses. Congratulations. I've you had lived about a 120 years ago you would have had developed the normal distribution, perhaps... :rofl:

    Edit: Aw Schroedinger, you were quicker than me. But it's no disgrace to be outran by a genius such as Schroedinger himself.

    ...or simply by his dog

    (just kidding)
    Last edited: Mar 3, 2008
  12. Mar 15, 2008 #11

    Think of a staircase. The first stair has a height of one. The second stair has a height of two and so on. The stair case forms a rough triangle, whose area is proportional to the square of the stair length. To make a long story short, the simple formula is:

    [itex]1+2+3+...+number of stairs=(number of stairs^2+number of stairs)/2[/itex]

    [itex]number of stairs = 100[/itex]



    Last edited: Mar 15, 2008
  13. Mar 15, 2008 #12

    Ime sure the poster to the thread said "easy".

    Not that its hard or anything, but considering the amount of words the poster put in this post, the poster wants an easy solution


  14. Mar 21, 2008 #13
    Consider using arithmetic progression's formula:

    n/2(a+n) where a is the 1st term = 1, and n is the number of terms = 100
  15. Mar 21, 2008 #14


    User Avatar

    1+100=101, 2+99=101, 3+98=101 etc. There are 50 pairs of these so it is 101 times 50 which equals 5050.
  16. Mar 21, 2008 #15


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    [tex]~~~~~=100+ \sum_{n=1}^{100}\frac{1}{n}[/tex]
    The remaining term above is a partial sum of a harmonic series. There is no simple, closed-form expression for such a partial sum to arbitrary number of terms. I think there are "compact expressions" for small partial sums and approximations for large ones, but that's all.
  17. Apr 2, 2008 #16
    An interesting consequence of being able to write down a formula for the sum of the first n naturals: we can write down a formula for the sum of the first n powers m, where m is any natural. To do so, we simply write

    [tex] \sum_{k=0}^{n-1} (k+1)^{m+1}=\sum_{k=0}^{n} k^{m+1} [/tex]


    [tex] \sum_{k=0}^{n-1} (k+1)^{m+1} - k^{m+1} = n^{m+1} [/tex]

    Of course, on the left, after a binomial expansion of the first term, we get rid of k^(m+1), left with with the sum of terms with the highest degree being m. So, if we know the formulas for the sums for the powers 1 to m-1, we determine the formula for m.

    Of course, it's not very good-looking as you go up... but it's still interesting.
  18. Apr 2, 2008 #17
    There's also the approximation [tex]log(100) + {\gamma}[/tex]

    With [tex]{\gamma} = 0.577215665...[/tex]

    I wonder if it's possible to measure the order of magnitude of the error.
    Last edited: Apr 2, 2008
  19. Apr 2, 2008 #18
    Just think about the series/sequence. I remember learning about this in an introductory calculus class when we started learning about sequences and series. From there, you can generate formulas such as these.
  20. Apr 14, 2008 #19

    J R

    User Avatar

    100 X 101 divided by 2 = answer. All numbers work the same. 50 x 51 divided by 2
    44 x 45 divided by 2 10 x 11 divided by 2
  21. Apr 14, 2008 #20

    J R

    User Avatar

    numbers 1 to100

    In other words the number you are adding times the next highest number divided by 2 = answer
  22. Apr 15, 2008 #21
    same thing as what Air said, but it just looks so pretty written out!

    1______+_______100_= 101
    _2_____+______99___= 101
    __3____+_____98____= 101
    ___49__+__52_______= 101
    ____50_+_51________= 101

    so you got 101 50 times 101x50=5050

    so... when summing numbers 1 to N
    sum = (N+1)(N)/2

    which simplifies out to the same thing JR said.
  23. May 3, 2008 #22
    Hi. A simple solution:

    Let's look at the case n = 5 and write it out like this:

    O O
    O O O
    O O O O
    O O O O O

    Immediately we see that we can fill it in like this:

    O = = = =
    O O = = =
    O O O = =
    O O O O =
    O O O O O

    So we've got a 5 x 5 square. Ignore the last row for now:

    O = = = =
    O O = = =
    O O O = =
    O O O O =

    This "thing" is symmetric along the diagonal. Hence, it seems like we could simply find the total number of elements and divide by 2. That is the case: (1/2)(4 x 5) = 10. Counting, you'll see that its correct. Note that we've added an auxiliary column to make this work. This suggests that for n = 5 we simply add a sixth column to make the array symmetric:

    O = = = = =
    O O = = = =
    O O O = = =
    O O O O = =
    O O O O O =

    Evidently this is 5 x 6, or more generally n(n + 1). Cutting in half gives us the elements we are looking for.

    So it seems like starting with n = 1 can't give us a symmetric array without adding an auxiliary column. So let's begin with n = 0. The "." is a placeholder.

    O O
    O O O
    O O O O

    Now this allows us to fill in with 4, 3, 2, and 1 extra elements on each row:

    = = = =
    O = = =
    O O = =
    O O O =
    O O O O

    We have 5 rows now. The formula follows.
  24. May 3, 2008 #23
    I've been messing around with the above method and it *seems* like the formula for the sum of the first n integers in the form [tex] \displaystyle\frac {m(m + 1)}{2}[/tex] is

    [tex]\displaystyle \frac {n^2(n + 1)}{2} - \left[\sum_{k = 0}^{n - 1} (n - k)(n - k - 1) \right][/tex].

    Not sure. I think its more or less completely useless. :rofl: I can show my work if anyone is interested.
    Last edited: May 3, 2008
  25. Jun 22, 2008 #24
    I know this topic is more than a month old, but I just couldn't help answering

    The formula is:
    S= n/2 [2a + (n-1)d]

    S is Sum of numbers
    n is number of numbers
    a is the starting number
    d is the difference between the first two numbers

    in this case,
    S=100/2[2x1 + (100-1)1]
    =50 x 101
    So, S=5050
  26. Jun 22, 2008 #25


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Here are some interesting articles on this "famous story"...

    "Gauss's Day of Reckoning"
    Brian Hayes
    May-June 2006, Volume 94, Number 3, Page: 200, DOI: 10.1511/2006.59.3483

    "Versions of the Gauss Schoolroom Anecdote"
    Brian Hayes
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook