What is the sum of $k^2(n - k)$ for $k = 1$ to $k = n$? What is the value of $\sum\limits_{k=1}^n k^2(n - k)$?
The problem I had was: 
for a square grid of size $n \times n$ how many squares have their corners on the intersecting points of the grid. (There are $n \times n$ points, the square's length is $n - 1$).
For every $k$-sized square there are $n - k$ possible squares with their corners laying on the edges of the bigger square. For every $k$-sized square there are $\frac{k(k + 1)(2k + 1)}{6}$ possible smaller squares.

Straightforward substitutions into known formulas (break it into two sums) gives:
$$\frac{1}{12} n (n+1) \left(n^2-n\right)$$
