Understanding the summation calculator — concept and principle
This calculator adds up iᵖ for every integer i from a starting value to an ending value, for example 1² + 2² + … + 100². Sums of powers appear in algebra and calculus courses, in the analysis of algorithms (counting loop operations), in Riemann sums that approximate integrals, and in many puzzle and contest problems. You choose the range and the power p.
How it is calculated
The calculator computes S = Σ iᵖ for i = m, m + 1, …, n by adding every term directly. For the common powers there are closed forms (sums from 1 to n):
- Σ i = n(n + 1)/2
- Σ i² = n(n + 1)(2n + 1)/6
- Σ i³ = [n(n + 1)/2]²
For a range starting at m > 1, subtract the sum from 1 to m − 1. The range is limited to 10 million terms.
The principle
The formula for Σ i comes from pairing: write 1 + 2 + … + n forwards and backwards; each column adds to n + 1, and there are n columns, so twice the sum is n(n + 1). The formula for Σ i² can be proved by induction or by telescoping: (i + 1)³ − i³ = 3i² + 3i + 1, and summing both sides from 1 to n makes the left side collapse to (n + 1)³ − 1. Solving for Σ i² gives n(n + 1)(2n + 1)/6. In general, Σ iᵖ from 1 to n grows roughly like nᵖ⁺¹/(p + 1), which mirrors ∫xᵖ dx.
Worked example
- Default inputs: from i = 1 to 100, power p = 2.
- Formula: 100 × 101 × 201 ÷ 6 = 2,030,100 ÷ 6.
- Result: 338,350, the same as adding 1 + 4 + 9 + … + 10,000 one by one.
- Comparison: 100³/3 ≈ 333,333, close to the exact sum, as the integral approximation suggests.
| Power p (sum of i^p) | Σ iᵖ |
|---|---|
| 0.5 | 671.4629471 |
| 1 | 5,050 |
| 1.5 | 40,501.22452 |
| 2 | 338,350 |
| 2.5 | 2,907,351.199 |
| 3 | 25,502,500 |
| 4 | 2,050,333,330 |
How to read the result
The result is an exact integer when the inputs are integers and the sum stays below about 9 × 10¹⁵. For comparison, Σ i from 1 to 100 is 5,050 and Σ i³ is 25,502,500. Negative p gives sums of reciprocals: p = −1 produces harmonic numbers, which grow only like ln n. Non-integer powers are allowed and give decimal results.
Common mistakes
- Using a closed form that starts at 1 when your range starts elsewhere.
- Off-by-one errors: from 1 to 100 contains 100 terms, from 0 to 100 contains 101.
- Using p = −1 or other negative powers with a range that includes i = 0, which divides by zero.
Frequently asked questions
What is the sum of the first n odd numbers?
n². For example, 1 + 3 + 5 + 7 = 16 = 4².
Does Σ 1/i² converge?
Yes. The infinite sum equals π²/6 ≈ 1.6449, a result first proved by Euler.
Why is Σ i³ the square of Σ i?
It is a classical identity (Nicomachus's theorem), provable by induction; for n = 100, 5,050² = 25,502,500.
Sources: Graham, R. L., Knuth, D. E., Patashnik, O., Concrete Mathematics, Chapter 2: Sums · NIST Digital Library of Mathematical Functions, §24.4 (Bernoulli polynomials, sums of powers) (dlmf.nist.gov)