Compute the sum of an arithmetic series from term count and first and last terms.
输入项数 n、首项 a₁ 与末项 aₙ,求前 n 项和。
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Arithmetic series sum | Sn = n(a1 + an) ÷ 2 = n·a1 + n(n−1)d ÷ 2 | Gauss anecdote / Zhang Qiujian c. 5th c. |
| nth term | an = a1 + (n−1)d with common difference d | Arithmetic sequence definition |
| Arithmetic mean | The arithmetic mean of a and b is (a+b) ÷ 2 | Mean definition |
| Sum proof | Pair S with its reversal; each pair sums alike → 2Sn = n(a1+an) | Classic pairing proof |