CalcSeed

Sum Calculator

Add every whole number from 1 up to n without counting them one by one.

=
Quick answer: with the default inputs (100), the sum is 5,050. Change any input to update the result.
Sum
—

What this calculator does

This calculator adds every whole number from 1 up to n in one step using the Gauss summation formula. At the defaults it sums 1 through 100, which is 5,050 — the famous schoolboy result Carl Friedrich Gauss reportedly produced in seconds when his class was told to add the numbers 1 to 100.

How the sum formula works

∑k=1nk=n(n+1)2\sum_{k=1}^{n}k=\frac{n(n+1)}{2}

The formula replaces n separate additions with one multiplication and one division. It is exact, not an approximation: n × (n + 1) is always even (one of two consecutive integers is even), so the division by 2 never leaves a remainder. The result is called a triangular number, because that many objects arrange into a perfect triangle — 10 billiard balls rack as the sum 1+2+3+4.

Where the formula comes from

Pair the first number with the last, the second with the second-to-last, and continue inward. Each pair sums to n + 1: for n = 100, the pairs (1, 100), (2, 99), (3, 98) all add to 101. There are exactly n ÷ 2 such pairs, so the total is 50 × 101 = 5,050. For odd n, one middle number stands alone, and the same formula handles it — pairing logic covers the middle term as half a pair.

Why Gauss took seconds, not minutes

Counting term by term needs n − 1 additions; the formula needs one multiplication and one division regardless of n. For n = 1,000,000 that is the difference between roughly a million operations and a single n × (n+1) ÷ 2 = 500,000,500,000. Any time a problem says add all numbers from a to b, the answer is S(b) − S(a − 1) with this formula applied twice.

Worked example: the sum 1 to 100

Step 1 — compute n × (n + 1). 100 × 101 = 10,100.

Step 2 — divide by 2. 10,100 ÷ 2 = 5,050. That is the sum of every integer from 1 to 100.

Verify by pairing. 50 pairs each summing to 101 give 50 × 101 = 5,050, matching exactly. The average of the numbers also checks out: 5,050 ÷ 100 = 50.5, which is (1 + 100) ÷ 2 — the midpoint of the range, as it must be for evenly spaced values. The arithmetic mean calculator leans on the same identity.

Common sums at a glance

nn × (n + 1)SumAverage of 1…n
11 × 211
1010 × 11555.5
5050 × 511,27525.5
100100 × 1015,05050.5
1,0001,000 × 1,001500,500500.5
10,00010,000 × 10,00150,005,0005,000.5

The average column shows the pattern that makes estimates instant: the average of 1 through n is always (n + 1) ÷ 2, so the sum is average × count. For n = 10,000 the average is 5,000.5 and 5,000.5 × 10,000 = 50,005,000, no long addition anywhere.

Sums over an arbitrary range

To add from a to b instead of 1 to n, compute S(b) − S(a − 1). The sum 40 through 60 is S(60) − S(39) = (60 × 61 ÷ 2) − (39 × 40 ÷ 2) = 1,830 − 780 = 1,050. Equivalently, count the terms (60 − 40 + 1 = 21), take their midpoint (50), and multiply: 21 × 50 = 1,050. The midpoint method works because the terms are evenly spaced.

Mistakes to avoid

  • Subtracting the wrong endpoint for a range sum: from 40 to 60, use S(39), not S(40), because 40 must be included; S(60) − S(40) drops the first term.
  • Counting terms off by one: 40 through 60 contains 21 numbers, not 20; the formula b − a + 1 handles it.
  • Forgetting the divide-by-2 step, which doubles every answer: 100 × 101 = 10,100 is the intermediate product, not the sum.
  • Applying the formula to non-unit steps: 1 to 100 in steps of 2 is a different arithmetic series, and the arithmetic sequence calculator handles that case.
  • Expecting decimals or negatives: this formula sums positive integers starting at 1; other starts go through the range method above.

Where the sum 1 to n shows up

  • Handshakes and pairings: n people all shaking hands once gives n(n−1)/2 pairs, a sibling formula, while n(n+1)/2 counts handshakes if you include shaking your own hand.
  • Bowling and racks: a full rack of 10 pins is the triangular number S(4), and stacked-can pyramids build on S(n) per layer.
  • Loop analysis in programming: an algorithm comparing every item to every later item runs in about S(n) steps, which is why it is called O(n²) work.
  • Schoolwork: Gauss-pairing problems, triangular numbers and series basics appear across middle- and high-school math.
  • Finance: total interest over a declining balance sequence, and day-count additions, often reduce to a 1-to-n sum.

The programming case is the most common in work life: code that loops i from 1 to n and j from i to n performs S(n) inner iterations in total, so doubling the input quadruples the runtime. Recognizing the triangular-number growth explains why some scripts stall at n = 10,000 while finishing instantly at n = 100.

Triangular numbers and related series

The output S(n) is the nth triangular number, part of a family: squares satisfy 1 + 4 + 9 + … + n² = n(n+1)(2n+1)/6, and cubes sum to [n(n+1)/2]² — the square of this formula. The factorial calculator covers the multiplicative cousin n!, which grows far faster: 10! = 3,628,800 while S(10) = 55. Adding is gentle growth; multiplying is explosive.

Frequently asked questions

How do I sum 1 to n quickly?

Use n × (n + 1) ÷ 2. For n = 100: 100 × 101 ÷ 2 = 5,050, no term-by-term addition needed.

Why is the sum of 1 to 100 equal to 5,050?

The 100 numbers form 50 pairs, each summing to 101 (1 + 100, 2 + 99, and so on), and 50 × 101 = 5,050. The formula computes the same product in one step.

How do I add numbers from 40 to 60?

Compute S(60) − S(39) = 1,830 − 780 = 1,050, or multiply the 21 terms by their midpoint 50. Both routes give 1,050.

Does the formula work for large n?

Yes, instantly. For n = 1,000,000 the sum is 500,000,500,000 — one multiplication and one division replace a million additions.

What is the average of 1 through n?

(n + 1) ÷ 2, the midpoint of the range. For 1 to 100 the average is 50.5, and 50.5 × 100 = 5,050 confirms the sum.

Is the answer always a whole number?

Yes. One of n and n + 1 is always even, so n × (n + 1) divides by 2 with no remainder.

What are triangular numbers?

The sums S(n) themselves: 1, 3, 6, 10, 15, 21 and so on, named because that many dots form a triangle. A full bowling rack of 10 pins is S(4).

How do I sum even numbers from 2 to 100?

Factor out the 2: it is 2 × (1 + 2 + … + 50) = 2 × 1,275 = 2,550. Factor, then apply the sum formula to the reduced count.

What is the sum of 1 to 10,000?

50,005,000. The formula gives 10,000 × 10,001 ÷ 2, and the average of the range is 5,000.5.

How fast does the sum grow?

Quadratically — multiplying n by 10 multiplies the sum by about 100. S(100) = 5,050 but S(1,000) = 500,500, one hundred times larger.

Method and sources

Calculation basis

Results follow exact mathematical definitions; the arithmetic is deterministic and can be verified by hand from the steps shown.

Last updated: November 17, 2026
Formula & data sources
  • Gauss summation formula for the first n positive integers.

Cite this page

Reference formats
APA 7CalcSeed. (2026, November 17). Sum Calculator. https://calcseed.com/c/math/sum-calculator/
MLA 9"Sum Calculator." CalcSeed, 17 Nov. 2026, calcseed.com/c/math/sum-calculator/.
ChicagoCalcSeed. "Sum Calculator." Last modified November 17, 2026. https://calcseed.com/c/math/sum-calculator/

Related calculators

More Math calculators