Sum of Cubes Calculator
The sum of the first n cubes adds 1 cubed, 2 cubed, 3 cubed and so on up to n cubed. A remarkable identity known as Nicomachus's theorem says this total always equals the square of the nth triangular number, so the sum of cubes is (n(n + 1) / 2) squared. This calculator evaluates that closed form directly and also shows the triangular number being squared, the largest single cube, and the count of terms. The result is always an exact whole number.
Sum of cubes formula
T(n) = n * (n + 1) / 2
Sum of cubes = T(n) squared = (n * (n + 1) / 2) ^ 2
Largest term = n ^ 3
Number of terms = n
By Nicomachus's theorem, the running sum of cubes equals the square of the running sum of integers. So you compute the triangular number first, then square it.
About sums of cubes
- The running sums begin 1, 9, 36, 100, 225, 441, all perfect squares.
- Each running sum equals the square of a triangular number, for example 100 = 10 squared.
- Nicomachus of Gerasa described this pattern around the year 100.
- The sums are also called squared triangular numbers.
- This identity makes adding many cubes fast: two multiplications and a square.
Sum of cubes: frequently asked questions
What is the sum of the first n cubes?
It is 1 cubed plus 2 cubed plus 3 cubed up to n cubed. The closed form is the square of the nth triangular number: (n(n + 1) / 2) squared. For n = 3 this gives (6) squared = 36, and indeed 1 + 8 + 27 = 36.
Why does the sum of cubes equal a square?
Nicomachus's theorem states that the sum of the first n cubes is always the square of the sum of the first n integers. So 1 cubed + 2 cubed + ... + n cubed equals (1 + 2 + ... + n) squared.
What is the formula for the sum of cubes?
Sum = (n times (n + 1) divided by 2), then squared. Equivalently it is the square of the nth triangular number T(n).
Is the result always a whole number?
Yes. The triangular number n(n + 1) / 2 is always an integer, and squaring an integer gives an integer, so the sum of cubes is always a whole number.
Is this the factoring identity a cubed plus b cubed?
No. This tool sums the cubes 1 through n. The algebra identity a cubed plus b cubed equals (a + b)(a squared minus ab plus b squared) is a separate factoring rule for two terms.
Official sources
- NIST Digital Library of Mathematical Functions: Lattice Paths and Binomial Coefficients.
- National Institute of Standards and Technology DADS: Dictionary of Algorithms and Data Structures.
Reviewed by the CalculatorHub team, edited by James Graham, 16 June 2026. See our methodology.