<s>[INST] Getting a closed form from $\sum_{i=1}^{n-1} \sum_{j=i+1}^{n} \sum_{k=1}^{j} 1$ I need to get a closed form from
$$
\sum_{i=1}^{n-1} \sum_{j=i+1}^{n} \sum_{k=1}^{j} 1
$$
Starting from the most outer summation, I got
$$
\sum_{k=1}^{j} 1 = j
$$
But now I don't know how to proceed with:
$$
\sum_{i=1}^{n-1} \sum_{j=i+1}^{n} j
$$
Could you guys please help me?
Thanks in advance.
 [/INST] Knowing that
\begin{align}
\sum_{k=1}^{n} (1) &= n \\
\sum_{k=1}^{n} k &= \frac{n \, (n+1)}{2} \\
\sum_{k=1}^{n} k^2 &= \frac{n(n+1)(2n+1)}{6}
\end{align}
then
\begin{align}
S &= \sum_{i=1}^{n-1} \sum_{j=i+1}^{n} \sum_{k=1}^{j} (1) \\
&= \sum_{i=1}^{n-1} \sum_{j=i+1}^{n} j \\
&= \sum_{i=1}^{n-1} \left(\sum_{j=1}^{n} j - \sum_{j=1}^{i} i \right) \\
&= \sum_{i=1}^{n-1} \left(\binom{n}{2} - \frac{i(i+1)}{2}\right)  \\
&= \binom{n}{2} \, \sum_{i=1}^{n-1} (1) - \frac{1}{2} \, \sum_{i=1}^{n-1} i^2 - \frac{1}{2} \, \sum_{i=1}^{n-1} i \\
&= \binom{n}{2} \, (n-1) - \frac{n(n-1)}{4} - \frac{n(n-1)(2n-1)}{12} \\
&= \frac{(n-1)(n)(n+1)}{3} = 2 \, \binom{n+1}{3}.
\end{align}
</s>