Sum of Numbers 1 to N
The calculator finds the sum of all numbers from 1 to N or from M to N using the Gauss formula with a step-by-step solution.
The sum of numbers calculator finds the sum of all whole numbers from 1 to N or from M to N using the Gauss formula and shows a step-by-step solution. Negative numbers work too.
Formula for the sum from 1 to N
1 + 2 + 3 + … + N = N · (N + 1)/2
Example. 1 + 2 + … + 100 = 100 · 101/2 = 5050
How Gauss came up with the formula
According to a well-known story, young Carl Friedrich Gauss was told by his teacher to add up all the numbers from 1 to 100 and gave the answer almost at once. He noticed that the numbers are easy to add in pairs — the first with the last, the second with the second-to-last:
1 + 100 = 101, 2 + 99 = 101, 3 + 98 = 101, …
There are 50 such pairs, each adding up to 101, so the sum is 50 · 101 = 5050.
Sum of numbers from M to N
Consecutive numbers form an arithmetic sequence with a step of 1, so their sum is half the sum of the first and last numbers times the number of terms:
S = (M + N) · n/2, where n = N − M + 1
Example. Find the sum of the numbers from 5 to 10.
n = 10 − 5 + 1 = 6
S = (5 + 10) · 6/2 = 45
Check: 5 + 6 + 7 + 8 + 9 + 10 = 45
Useful facts
- The sum of the first n odd numbers is n2: 1 + 3 + 5 + 7 = 16 = 42.
- The sum of the numbers from −N to N is zero: the negative and positive terms cancel out.
- The sum divided by the number of terms is the average, and it equals half the sum of the first and last numbers.