Skip to content
Omnikalc

Sum of powers calculator: sum of squares, cubes, 4th and 5th powers between two integers

Enter the first and the last integer and a power from 1 to 5 to get the sum of the powers, the number of terms, the average term and the sum from 1.

Updated on
Your inputs

Value out of range

Value out of range

Results

Sum of the powers from the first to the last integer

1,625,525

Number of terms
46
Average term
35,337.5
Sum from 1 to the last integer
1,625,625
Sum divided by the last term
13.004

The sum of powers adds the squares, the cubes or the higher powers of consecutive integers. The sum of powers calculator uses Faulhaber’s formulas to give the sum between two integers, the number of terms, the average term, the sum from 1 and the ratio to the last term, without adding the terms one by one.

How the calculation works

  • Enter the first integer and the last integer of the sum. To sum from 1, enter 1 as the first integer.
  • Choose the power: 1 for the integers, 2 for the squares, 3 for the cubes, and 4 or 5 for higher powers.
  • The calculator uses Faulhaber’s formulas, for example 1² + … + n² = n (n + 1)(2n + 1) / 6 and 1³ + … + n³ = (n (n + 1) / 2)², with no loop.
  • A sum between two integers is the sum up to the last integer minus the sum up to the integer before the first. The calculator also gives the number of terms, the average term and the ratio to the last term.

Example

Take the cubes of the integers from 5 to 50. The sum from 1 to 50 is (50 × 51 / 2)² = 1,275² = 1,625,625. The sum from 1 to 4 is 10² = 100. So the sum from 5 to 50 is 1,625,625 − 100 = 1,625,525. There are 46 terms, so the average term is 35,337.5. The sum is 13.004 times the last term 50³ = 125,000.

Why it matters

The calculator helps students who study series and induction, programmers who want to check a loop, teachers who prepare exercises and anyone who needs a quick total of squares or cubes. The closed formulas show how the total grows with the number of terms, which is useful to estimate the cost of an algorithm with nested loops.

Good to know

The calculator works for integers from 1 to 100,000 and powers from 1 to 5. For the largest values the total is very large and may exceed the precision of 15 digits of the computer, so the last digits can be inexact. A sum of the form 2² + 4² + … or of odd numbers can be found from the same formulas by a simple change, for example by taking the sum of squares up to 2n and removing the odd terms.

The arithmetic-geometric series calculator handles sums with a ratio, the harmonic series calculator adds the inverses of the integers, the triangular numbers calculator gives the sum of the integers, and the polygonal numbers calculator handles other figurate numbers.

Frequently asked questions

What is Faulhaber’s formula?

Faulhaber’s formula gives the sum of the first n integers raised to a power p as a polynomial in n of degree p + 1. For p = 1 it gives n (n + 1) / 2, for p = 2 it gives n (n + 1)(2n + 1) / 6, and for p = 3 it gives the square of the sum of the integers. The coefficients are related to the Bernoulli numbers.

What is the sum of the first n squares?

The sum of the first n squares is n (n + 1)(2n + 1) / 6. For n = 10 it is 385, and for n = 100 it is 338,350. The formula grows like n³ / 3 for large n, which is also what the integral of x² from 0 to n gives. It is used in statistics, in physics and in the computation of areas.

Why is the sum of cubes a perfect square?

The sum of the first n cubes is equal to the square of the sum of the first n integers, which is (n (n + 1) / 2)². This is Nicomachus’s theorem. For n = 4, the sum 1 + 8 + 27 + 64 = 100 is the square of 10. A picture with nested squares of side k shows this fact without algebra.

How do I sum between two numbers that do not start at 1?

Compute the sum from 1 to the last number and subtract the sum from 1 to the number before the first. For the squares from 10 to 20, take the sum up to 20, which is 2,870, and subtract the sum up to 9, which is 285, to get 2,585. The calculator does this subtraction for you, for any of the five powers.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.