The 6th problem is: The difference between the sum squared and the squared sum of proceeding numbers. We can solve this purely analytically:

$$ x = \sum_{i=1}^n i^2 - \left( \sum_{i=1}^n i \right)^2 $$

We now apply the gaussian and square sum formular

$$ \begin{align} x &= \frac{n^3}{3} + \frac{n^2}{2} + \frac{n}{6} - \left( \frac{n^2+n}{2} \right)^2 \\ &= -\frac{n^3}{6} - \frac{n^4}{4} + \frac{n^2}{4} + \frac{n}{6} \\ &= \frac{n^2}{4} \cdot \left(1-n^2 \right) + \frac{n}{6} \cdot \left(1-n^2 \right) \\ &= \frac{n}{12} \cdot \left( 3n + 2 \right) \cdot \left( 1 - n^2 \right) \end{align} $$