Sum of Cubes Calculator

Add the cubes of the first n whole numbers using the square of a triangular number.

Math and PercentUpdated 2026-11-192 min read
Sum of Cubes Calculator
A whole number from 1 to 100,000.
Sum of cubes
...
nth triangular number...
n used...
Identity...

What it does

The sum of cubes of the first n positive whole numbers has a remarkably compact closed form. You do not need to cube and add every term, because the total is exactly the square of the nth triangular number.

This tool takes n and returns the sum, the triangular number being squared, and the identity in words. The page opens with n equals 4, where the cubes one, eight, twenty seven and sixty four add to one hundred.

The triangular number for n equals 4 is 4 times 5 divided by 2, which is 10. Squaring 10 gives 100, matching the direct sum. This agreement is not a coincidence but a general theorem.

The identity can be proved by induction, by telescoping the expansion of n to the fourth power, or by counting rectangles on a checkerboard. It belongs to the same family as the formulas for sums of whole numbers and their squares.

The result grows quickly, so a closed form is much more practical than a loop for large n. The tool accepts n up to one hundred thousand and reports the exact integer.

How to use

  1. Enter the last whole number n.
  2. Read the sum of cubes as the main result.
  3. Check the triangular number that was squared.
  4. Verify the result by cubing a few small terms by hand.
  5. Try n = 10 to see the familiar total of 3,025.
  6. Compare with the sum of squares to see how much faster cubes grow.

Formula

Sum from k = 1 to n of k cubed = (n times (n+1) / 2) squared = n squared times (n+1) squared / 4
n
The last whole number included in the sum.
triangular number
n times n plus 1 divided by 2, the sum of the first n whole numbers.
sum
The total of the first n cubes, equal to the square of the triangular number.

One proof uses the identity for the difference of consecutive fourth powers and the known formulas for sums of whole numbers and squares. Another uses induction, adding the next cube and verifying the algebra simplifies to the next triangular square.

Worked example

Example: first four cubes

The page opens with n = 4.

  1. List the cubes: 1 cubed is 1, 2 cubed is 8, 3 cubed is 27 and 4 cubed is 64.
  2. Add them directly: 1 plus 8 plus 27 plus 64 is 100.
  3. Compute the fourth triangular number: 4 times 5 divided by 2 is 10.
  4. Square 10 to get 100, matching the direct sum.
  5. The alternate form gives 4 squared times 5 squared divided by 4, which is 16 times 25 divided by 4, also 100.
  6. The tool reports sum 100 and triangular 10.

Reference table

Sums of cubes for small n
nCubes addedTriangular numberSum of cubes
41, 8, 27, 6410100
101 cubed through 10 cubed553,025

Limits

  • Accepts whole numbers of n from 1 to 100,000.
  • Uses the positive whole numbers starting at 1.
  • The result is an exact integer with no rounding.
  • The tool does not sum cubes of an arbitrary list of numbers.

Common mistakes

  • Squaring n instead of the triangular number.
  • Starting the sum at zero and expecting a different result.
  • Using the formula for sums of squares by mistake.
  • Forgetting that the triangular number divides by 2 before squaring.
  • Expecting the sum to grow linearly with n.

Try it yourself

Quick checks. Answers sit tucked under each question.

Sum of the first ten cubes?

3,025, the square of the tenth triangular number 55.

What triangular number corresponds to n = 4?

10, from 4 times 5 divided by 2.

Is the sum of cubes the same as the sum of squares?

No. The square sum uses n times n plus 1 times 2n plus 1 over 6.

Questions

What is the closed form?

The square of n times n plus 1 over 2.

Why is it the square of a triangular number?

It follows from expanding fourth powers or by a combinatorial counting argument.

Who discovered this identity?

It is often called Nicomachus's theorem after the ancient Greek mathematician.

Does it work for n = 1?

Yes. One cubed is 1, and the first triangular number squared is also 1.

How fast does the sum grow?

Roughly like n to the fourth power divided by 4.

Can the result be a fraction?

No. It is always a whole number.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.