Adding the First 1000 Positive Integers

1 + 2 + 3 + … 998 + 999 + 1000 = ?

Do you think you can arrive at the (correct) answer in 20 seconds? In under 10 seconds?

Do you think you can beat Mathematica’s 2.5 seconds record?

SumOf1000Integers

(Yes, Mathematica makes it that easy. Just access  https://lab.open.wolframcloud.com/app/ , scroll at the bottom of the page and click on Create a New Notebook. The blank white page is your work space. Click the cursor at the top of the page and type in the equal sign, and then write sum of the first 1000 positive integers, as shown above. Finally, shift + enter to see the output.)

Without Mathematica though, we still have Gauss’ method that should give us the answer in under 10 seconds.

Ready? Start!

First, line up the integers from 1 to 1000. On a second line, line up the integers from 1000 down to 1.  Now you can pair the numbers from each line as shown below.

1    +    2    +    3    +   …    +  998  +  999  +  1000

1000 +  999  +  998 +   …    +    3    +    2     +     1

———————————————————————— (+)

(1 + 1000) + (2 + 999) + … + (999 + 2) + (1000 + 1) =

1001 + 1001  + 1001 +  …  +  1001  + 1001  + 1001

There are 1000 terms of 1001. Since you added all the integers from 1 to 1000 twice, then you only need half of these terms (500 terms of 1001) to find the sum off all the integers from 1 to 1000.

1 + 2 + 3 + … 998 + 999 + 1000 = 500 x 1001 = 500500.

Not more than 7.5 seconds, true? Watch out Mathematica, we are right behind you!