Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Sum of squares 1² + 2² + … + n²
385
for n = 10
Sum of integers (1+2+…+n) 55
Mean of the squares 38.5

What is the sum of squares?

The sum of squares of the first n positive integers is the total you get by squaring each whole number from 1 up to n and adding the results: \(1^2 + 2^2 + 3^2 + \ldots + n^2\). Instead of adding every term one at a time, you can use a famous closed-form formula that gives the answer in a single step, no matter how large n is.

Stack of increasingly large grid squares representing 1 squared plus 2 squared up to n squared
The sum of squares adds the areas of squares of side 1, 2, 3, up to n.

The formula explained

The compact identity is:

$$\sum_{k=1}^{n} k^2 = \frac{n\left(n+1\right)\left(2\,n+1\right)}{6}$$

Here n is the largest integer in your sequence. Multiply n by \((n+1)\) and by \((2n+1)\), then divide by 6. The result is always a whole number because the product of these three factors is always divisible by 6. This calculator also reports the related sum of integers, \(\frac{n(n+1)}{2}\), and the mean of the squares.

Advertisement
Diagram of the formula n times (n plus 1) times (2n plus 1) all divided by 6
The closed-form formula gives the result directly without adding term by term.

How to use this calculator

Enter the upper limit n — the last integer in the series — and the tool returns the exact sum instantly. Use it to check homework, verify code, or speed up statistics work, since sums of squares appear in variance, standard deviation, and regression formulas.

Worked example

Suppose n = 5. The terms are 1, 4, 9, 16, 25, which add to 55. Using the formula: $$\frac{5 \times 6 \times 11}{6} = \frac{330}{6} = 55.$$ The closed form matches the direct addition perfectly.

FAQ

Does this work for any n? Yes — for any positive whole number n. Very large values still compute instantly thanks to the formula.

Why divide by 6? The product \(n(n+1)(2n+1)\) is always a multiple of 6, which is why the formula yields an integer.

Can I include 0? Adding \(0^2 = 0\) does not change the sum, so the result for n stays the same whether or not you count zero.

Last updated: