Classic sum 1 to n
1 + 2 + … + n = n(n + 1)/2. Example: 1 + … + 100 = 5,050.
1 + 2 + … + n with Gauss's formula, any range a to b, and quadratic Gauss sums g(a; n).
Enter your values below to get started.
Type huge values such as 10^20 as digits: 100000000000000000000. The answer stays exact.
The sum from a to b equals Tb − Ta−1, where Tn = n(n + 1)/2.
A range with as many negative terms as positive terms, such as −10 to 10, adds to 0.
For g(a; n), pick an odd prime n such as 5, 7, 11 or 13 to see Gauss's √n result.
A Gauss sum calculator adds the whole numbers 1 + 2 + … + n in one step with the formula n(n + 1)/2. Enter n to get the sum, or enter a first and last term to add any run of consecutive integers, including negative ones. A third mode evaluates the quadratic Gauss sum g(a; n) from number theory and draws its path in the complex plane.
A Gauss sum is the total of the consecutive whole numbers 1 + 2 + 3 + … + n, found with the formula n(n + 1)/2 instead of adding term by term. The sum 1 + 2 + … + 100 equals 100 × 101 / 2 = 5,050.
The name comes from Carl Friedrich Gauss (1777–1855). Biographer Wolfgang Sartorius von Waltershausen wrote in 1856 that young Gauss, set the task of adding 1 to 100 by teacher J. G. Büttner in Brunswick, wrote 5,050 on his slate within moments. Gauss saw that 1 + 100, 2 + 99, 3 + 98 and every other pair add to 101, and that 100 numbers make 50 such pairs.
In number theory, the term Gauss sum names a second object: the quadratic Gauss sum g(a; n) = Σ e2πi·a·k²/n, a sum of complex roots of unity. The calculator handles both meanings.
The Gauss sum calculator counts the terms, adds the first and last term, multiplies the two results and divides by 2. All 3 operations run on exact whole numbers (JavaScript BigInt), so a 40-digit n gives every digit of the answer with no rounding.
From 1 to n there are n terms; from a to b there are b − a + 1 terms.
1 + n, or a + b. Every mirrored pair has this same total.
S = (number of terms) × (first + last) / 2.
The steps tab writes the sum forward and backward, and the chart tab draws the two staircases of dots.
The Gauss sum formula is S = n(n + 1)/2 for 1 + 2 + … + n, and S = N(a + b)/2 for the N consecutive integers from a to b. Both formulas say the same thing: the sum equals the number of terms times the average term.
Tn is the n-th triangular number: T10 = 55, T100 = 5,050, T1000 = 500,500.
For 50 to 100: N = 51 terms, a + b = 150, S = 51 × 150 / 2 = 3,825.
For an odd prime p, g(1; p) = √p when p ≡ 1 (mod 4) and i√p when p ≡ 3 (mod 4).
There are 5 common types of Gauss sums: the classic 1 to n sum, a range of consecutive integers, the sum of odd numbers, the sum of even numbers or multiples, and the quadratic Gauss sum of number theory. The first 4 types are arithmetic series that Gauss's pairing trick solves; the fifth type is a sum of complex numbers.
1 + 2 + … + n = n(n + 1)/2. Example: 1 + … + 100 = 5,050.
(b − a + 1)(a + b)/2. Example: 101 + … + 200 = 15,050.
1 + 3 + … + (2n − 1) = n². Example: the first 10 odd numbers add to 100.
2 + 4 + … + 2n = n(n + 1); 5 + 10 + … + 5n = 5n(n + 1)/2.
Σ e2πi·a·k²/n. For an odd prime p, |g(1; p)| = √p.
To calculate a Gauss sum by hand, count the terms, add the first and last term, multiply those 2 numbers and divide by 2. Here is 1 + 2 + … + 100:
Divide the even factor first to keep the numbers small: for n = 1,000, compute 500 × 1,001 = 500,500.
Every Gauss sum 1 + 2 + … + n is a triangular number Tn, the number of dots in a triangle with n rows. The first 10 triangular numbers are 1, 3, 6, 10, 15, 21, 28, 36, 45 and 55.
To test whether a number S is triangular, solve n(n + 1)/2 = S for n:
S is triangular exactly when 1 + 8S is a perfect square. For S = 5,050, 1 + 8S = 40,401 = 201², so n = 100. Gauss recorded in his diary on 10 July 1796 that every whole number is the sum of at most 3 triangular numbers (“ΕΥΡΗΚΑ! num = Δ + Δ + Δ”).
A quadratic Gauss sum g(a; n) adds the n complex numbers e2πi·a·k²/n for k = 0 to n − 1, and for a = 1 its value is always √n times 1, i, 1 + i or 0. Gauss studied these sums in Disquisitiones Arithmeticae (1801) and proved the sign of the answer in 1805, after 4 years of attempts.
For an odd prime p and a not divisible by p, g(a; p) = (a/p)·g(1; p), where (a/p) is the Legendre symbol (+1 or −1). Example: (2/13) = −1, so g(2; 13) = −√13 ≈ −3.6056. Quadratic Gauss sums give one of the proofs of the law of quadratic reciprocity.
Pick a mode, type the numbers and press Calculate. The result shows the exact sum, the number of terms and the average term; the tabs hold the pairing steps, a table of running totals and a chart.
1 + 2 + … + n, From a to b, or Quadratic Gauss sum g(a; n).
n for the classic sum; a and b for a range; modulus n and coefficient a for g.
The sum appears with thousands separators; Copy puts the plain digits on the clipboard.
Open Step-by-step to see the forward-and-backward proof with your numbers.
The Gauss sum counts anything that grows by 1 at each step or pairs every item with every other item. There are 5 everyday uses:
Common Gauss sums with their exact values. Click a row to load it.
| Sum | Terms | Value | Calculator |
|---|---|---|---|
| 10 | 55 | ||
| 100 | 5,050 | ||
| 1,000 | 500,500 | ||
| 365 | 66,795 | ||
| 51 | 3,825 | ||
| 18 | 63 | ||
| 5 | √5 ≈ 2.2361 | ||
| 7 | i√7 ≈ 2.6458i |
Try each one, then reveal the answer or solve it in the calculator.
Add the whole numbers from 1 to 50.
Add the whole numbers from 1 to 200.
Add the integers from 21 to 40.
Add the integers from −10 to 10.
25 people shake hands once with every other person. How many handshakes? (Add 1 to 24.)
Evaluate the quadratic Gauss sum g(1; 11).
Discover 67 free sum calculators across different categories. Find the right calculator for your needs.
Try a different name or choose another category.
The Gauss sum formula is n(n + 1)/2, the total of 1 + 2 + … + n. For any run of consecutive integers from a to b, the formula is (b − a + 1)(a + b)/2.
1 + 2 + 3 + … + 100 = 5,050, found as 100 × 101 / 2. This is the sum young Carl Friedrich Gauss is said to have found in his Brunswick classroom.
Yes, the story is reported by Gauss's friend and biographer Wolfgang Sartorius von Waltershausen in 1856, though the exact numbers in the original task are not recorded. Later retellings fixed the task as 1 to 100.
Multiply the number of terms by the sum of the first and last term, then divide by 2. For 21 to 40: 20 × 61 / 2 = 610.
Yes, 1 + 2 + … + n is the n-th triangular number T<sub>n</sub>, the number of dots in a triangle with n rows. T<sub>4</sub> = 10, the bowling-pin triangle.
Yes, the formula (b − a + 1)(a + b)/2 works for any integers a ≤ b. The sum from −5 to 12 is 18 × 7 / 2 = 63.
A quadratic Gauss sum g(a; n) is the sum of e<sup>2πi·a·k²/n</sup> for k = 0 to n − 1. For an odd prime p, g(1; p) equals √p if p ≡ 1 (mod 4) and i√p if p ≡ 3 (mod 4).
A Gauss sum 1 + 2 + … + n is the simplest arithmetic series, with first term 1 and common difference 1. The general arithmetic series formula n(a₁ + aₙ)/2 is Gauss's pairing idea applied to any common difference.
The Gauss sum calculator accepts n with up to 40 digits and returns every digit of the answer, since the arithmetic runs on exact integers.
The Gauss sum turns 1 + 2 + … + n into one multiplication, n(n + 1)/2, and the Gauss sum calculator applies that pairing idea to any range of integers and to the quadratic Gauss sums of number theory. Use the 1 to n mode for triangular numbers, the a to b mode for any run of consecutive integers, and the g(a; n) mode for roots-of-unity sums.
Not sure which mode fits your problem? Answer the questions below.