# Sum Of Sequence

The series $\sum\limits\_{k=1}^n k^a = 1^a + 2^a + 3^a + \dots + n^a$ gives the sum of the $a^\text{th}$ powers of the first nn positive numbers, where aa and $n$ are positive integers. Each of these series can be calculated through a closed-form formula.

The case $a=1,n=100$ is famously said to have been solved by Gauss as a young schoolboy: given the tedious task of adding the first 100 positive integers, Gauss quickly used a formula to calculate the sum of 5050.

The formulas for the first few values of $a$ are as follows:

$$\sum\limits\_{k=1}^n k = \frac{n(n+1)}{2}$$

$$\sum\limits\_{k=1}^n k^2 = \frac{n(n+1)(2n+1)}{6}$$

$$\sum\limits\_{k=1}^n k^3 = \frac{n^2(n+1)^2}{4}$$

## Reference

* <https://brilliant.org/wiki/sum-of-n-n2-or-n3/>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://liuzhenglaichn.gitbook.io/algorithm/math/sum-of-sequence.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
