If for whatever reason you ever need to know the sum of all the integers from 1 up any number at all, you can take the time to add them all up manually or figure out an easier way to arrive at the answer. In the table below multiples of 10 are matched to the sum of all the numbers from 0 up to that multiple of 10. Do you see the pattern?
Multiple of 10 Sum of numbers from 0 up to X
1 1
10 55
100 5050
1000 500500
10000 50005000
100000 5000050000
1000000 500000500000
This is a great example of why you need to think about a math problem before actually diving into the math.
If you were asked to add up all the numbers from 1+2+3+4 all the way to 10 you would likely either add it up in your head or maybe use a pen and paper and arrive at the answer 55. That's easy enough, not too much thinking required, just plug and chug.
But the same problem is not so easy for adding up the numbers between 1 and 100. Here is where the lazy and bright might figure out that to add up the numbers between 0 and 100 they could just add 0+100, 1+99, 2+98, 3+97, 4+96,.. etc,.. 49+51 and the answer would be 50 ways to add up to 100 with 50 in the middle leftover or 5,050.
So then the pattern is this, 50+50 is 100 and 5,050 is the sum of all the digits from 1 to 100. The same pattern predicts that the digit sum of 1,000 is 500,500.
This then leads to an easy way to calculate the sum of integers from 0 up the number itself.
The sum of all numbers from 1 to X = (X*X+X)/2
I hope you get to use that little math trick someday.
No comments:
Post a Comment