Number of Triples Between $1$ and $n$ The exact question is:
Let $n$ be a positive integer. Find the number of triples $(a,b,c)$ such that $1\leq a\leq b\leq c\leq n$ .

Suppose $b=k$, then there are $k$ possible values for $a$ (from $1$ to $k$) and $n-k+1$ values for $c$ (from $k$ to $n$). That makes a total of $k(n-k+1)$ possibilities for each value of $k$ from $1$ to $n$:
$$\begin{align}
\sum_{k=1}^n k(n-k+1) &= (n+1)\sum_{k=1}^n k - \sum_{k=1}^n k^2\\
&= \frac{n(n+1)}{2}(n+1) - \frac{n(n+1)}{6}(2n+1)\\
&= \frac{n(n+1)}{6}(3n+3-2n-1)\\
&= \frac{n(n+1)}{6}(n+2)
\end{align}$$
(For the formulas used to solve the sums, check Faulhaber's formula)
