<s>[INST] Find the sum to n terms $$S=1^2+3^2+6^2+10^2+15^2+.......$$
My attempt is as follows:
$$T_n=\left(\frac{n\cdot\left(n+1\right))}{2}\right)^2$$
$$T_n=\frac{n^4+n^2+2\cdot n^3}{4}$$
$$S=\frac{1}{4}\cdot\sum_{n=1}^{n}\left(n^4+n^2+2\cdot n^3\right)$$ 
Now to solve this one has to calculate $\sum_{n=1}^{n}n^4$ which will be a very lengthy process, is there any shorter method to solve this question?
By the way I calculated $\sum_{n=1}^{n}n^4$ and it came as $\dfrac{\left(n\right)\cdot\left(n+1\right)\cdot\left(2\cdot n+1\right)\cdot\left(3\cdot n^2+3\cdot n-1\right)}{30}$, then I substituted this value into the original equation.
Then I got final answer as $\dfrac{\left(n\right)\cdot\left(n+1\right)\cdot\left(n+2\right)\cdot\left(3\cdot n^2+6\cdot n+1\right)}{60}$
But it took me a very long time to calculate all of this, is there any shorter way to solve this problem?
 [/INST] Once you’ve rewritten your sum as $\frac14\sum_{k=1}^n k^4+2k^3+k^2$ it’s not terribly difficult to compute this using generating functions if you use some key tools for manipulating them. To wit, if $g(x)$ is the ordinary generating function for the sequence $\{a_n\}_{n=0}^\infty$, then $g(x)/(1-x)$ is the o.g.f. for the sequence of partial sums $\{\sum_{k=0}^na_k\}_{n=0}^\infty$, and similarly, $x\frac d{dx}g(x)$ is the o.g.f. for $\{na_n\}_{n=0}^\infty$. So, starting with the o.g.f. $(1-x)^{-1}$ for the sequence of all ones, we have $$\left\{\sum_{k=0}^n k^2\right\}_{n=0}^\infty \stackrel{ogf}{\longleftrightarrow} \frac1{1-x}\left(x\frac d{dx}\right)^2\frac1{1-x} = {x+x^2 \over (1-x)^4},$$ therefore $$\sum_{k=0}^n k^2 = [x^n]{x+x^2\over(1-x)^4} = [x^{n-1}]\frac1{(1-x)^4} + [x^{n-2}]\frac1{(1-x)^4},$$ which you can compute using the generalized binomial theorem. Similarly, $$\sum_{k=0}^n k^3 = [x^n]{x+4x^2+x^3\over(1-x)^5} \\ \sum_{k=0}^n k^4 = [x^n]{x+11x^2+11x^3+x^4\over(1-x)^6}.$$
</s>