The formula to sum from 1 to n (n is any integer greater than 1) is n(n+1)/2 and thus sum from 1 to 100 = 100(100 + 1)/2 = (50)(101) = 5050.
You can break the logic into 6 steps on adding numbers from 1 to 100
- Divide the sequence into two subsequences of half the total number 100/2 = 50.
- Place the first subsequence in natural numerical order 1,2,3, …,50
- Place under the above subsequence the second subsequence but in reverse order. Begin with 100, 99, 98, …, 51.
- Add each of the columns of two numbers from the sequence. The first column is 1+100=101, the second column is 2+99 = 101, until you get to 50+51 = 101.
- Since we have 50 numbers as the result of the columns additions and these 50 numbers are 101. The total number representing the sum is 50*101 = 5050.
- The sum 1+2+3+ …+100 = 5050