Sum of the First n Integers, Squares and Cubes Calculator
Written by Thierno Sadou Diallo, formula verified per our methodology • Last checked on 12/10/2026
The sum of the first n integers is n(n+1)/2, of squares n(n+1)(2n+1)/6 and of cubes (n(n+1)/2)². For n = 100: 5,050, 338,350 and 25,502,500.
Explanation
Legend says a German schoolteacher, wanting to keep his class busy, asked pupils to add the integers from 1 to 100. The young Carl Friedrich Gauss handed in his answer within seconds: 5,050. His idea, captured in the formula n(n+1)/2, was to pair the extreme terms: 1 + 100, 2 + 99, 3 + 98 and so on always give 101, and there are 50 pairs. The sum of squares, 1² + 2² + … + n², equals n(n+1)(2n+1)/6. It can be proven by induction, or by counting the small cubes of a pyramid of square layers in two ways. The sum of cubes, 1³ + 2³ + … + n³, is more surprising: it equals (n(n+1)/2)², the square of the sum of the integers. For n = 10, the sum of integers is 55 and the sum of cubes 55² = 3,025. It is one of the most beautiful results of elementary arithmetic, known since antiquity. These three formulas are special cases of a family, Faulhaber's, which gives the sum of k-th powers as a polynomial in n. The calculator adds two classic sums: the sum of the first n odd numbers, which equals n² (1 + 3 + 5 + 7 = 16, a perfect square), and the sum of the first n even numbers, n(n+1). These formulas serve in computer science to estimate the number of operations of a double loop (1 + 2 + … + n operations give n(n+1)/2), in statistics, in physics and in all regular sum calculations. The limit on n is set at 10,000 so that results, up to 2.5 quadrillion for cubes, stay exact on display. For other sequences, see the arithmetic sequence calculator and the geometric sequence calculator.
Example: n = 10
Inputs
The first ten integers, from 1 to 10.
Calculation
Integers: 10 × 11 / 2 = 55. Squares: 10 × 11 × 21 / 6 = 385. Cubes: 55² = 3,025. Odd: 10² = 100. Even: 10 × 11 = 110.
Result
The sums are 55, 385 and 3,025; note that the sum of cubes is indeed the square of the sum of integers.
Frequently asked questions
How can I recall Gauss’s formula without memorizing it?
Write the sum forwards and backwards and add term by term: each pair makes n + 1, and there are n pairs. The total is n × (n + 1), which counts the sum twice: divide by 2.
Why is the sum of cubes a perfect square?
It is Nicomachus’s theorem: the sum of the first n cubes is always the square of the sum of the first n integers. It can be proven by induction or by a geometric dissection of a square.
Can I sum starting from an integer other than 1?
Yes: subtract sums. For example, the sum of integers from 11 to 20 is the sum from 1 to 20 minus the sum from 1 to 10, that is 210 − 55 = 155.