Sum of Squares Calculator
Sum 1 squared to n squared with closed form and average.
What it does
Adding squares by hand grows fast. One squared plus two squared up to ten squared already needs ten multiplications and nine additions. The closed form n(n+1)(2n+1)/6 replaces all of that with one pass.
The tool above takes n and returns sum, next sum at n+1, and mean square. The default n = 100 matches the worked example, so the page opens showing 338,350. Type a new n to update all three results.
Squares pile in layers. Ten layers sum to 385, a hundred to 338,350, a thousand past 300 million. Mean square divides by n, so 338,350 over 100 averages 3,383.5 per term. That average sits near n squared over 3 for large n.
Use this for series checks, variance numerators, and programming loop tests. For cubes use the square of the triangular number instead. For plain 1 to n use n(n+1)/2.
This page shows the formula, one full hand checked example at n = 100, a short table, and practice checks that run through the tool.
How to use
- Pick the last n you sum to, for example 100.
- Type n as a whole number.
- Keep n between 1 and 100000 for exact integer math.
- Read Sum as the main result.
- Read Next for n+1 to see growth.
- Use Mean square to compare densities across n.
Formula
- n
- Last whole number squared and summed.
- S(n)
- 1 squared + ... + n squared.
- mean
- S(n) divided by n.
Numerator is always divisible by 6 for whole n, so results stay whole. Cap at 100000 keeps browser integers exact.
Worked example
Example: n = 100
Sum squares from 1 to 100.
- Write n = 100.
- n+1 = 101, 2n+1 = 201.
- Multiply: 100 x 101 x 201 = 2,030,100.
- Divide: 2,030,100 / 6 = 338,350.
- Mean: 338,350 / 100 = 3,383.5.
- Next: 101 x 102 x 203 / 6 = 348,551.
Reference table
| n | Sum | Mean |
|---|---|---|
| 1 | 1 | 1 |
| 2 | 5 | 2.5 |
| 10 | 385 | 38.5 |
| 100 | 338,350 | 3,383.5 |
Limits
- Whole n only from 1 to 100000.
- Squares only. Cubes and plain sums need other tools.
- Exact integer math assumed. Rounded inputs are rejected.
- Large sums need commas and width. Check digits before printing.
Common mistakes
- Using n squared over 3 alone and skipping the exact form.
- Adding 1 after multiplying instead of before.
- Entering n = 0 and expecting squares.
- Confusing sum of squares with square of sum.
- Reading mean square as root mean square without rooting.
Try it yourself
Quick checks. Answers sit tucked under each question.
Sum to 10?
Sum 385, next 506, mean 38.5.
Mean for n = 100?
338,350 over 100 is 3,383.5.
Questions
What is sum of squares?
n(n+1)(2n+1)/6. For 100 it is 338,350.
Why divide by 6?
The product of three consecutive style terms always carries factor 6.
Next sum?
Apply form at n+1. After 338,350 comes 348,551.
Sum vs square of sum?
Different. Squares sum to 385 at 10, plain sum squared is 3025.
Max n?
100000 here for exact integers.
Mean square?
Sum over n. Here 3,383.5.