Our solution is the coefficient of $\displaystyle x^d$ in the following polynomial: $\displaystyle

\sum\limits_{1 \leqslant k \leqslant d} {\left( {1 + x + ... + x^n } \right)^k } = \sum\limits_{1 \leqslant k \leqslant d} {\left( {\tfrac{{1 - x^{n + 1} }}

{{1 - x}}} \right)^k } = \sum\limits_{1 \leqslant k \leqslant d} {\left( {\tfrac{1}

{{1 - x}}} \right)^k \left( {1 - x^{n + 1} } \right)^k }

$

Now write both, $\displaystyle

{\left( {\tfrac{1}

{{1 - x}}} \right)^k }

$ and $\displaystyle

{\left( {1 - x^{n + 1} } \right)^k }

$ as power series and multiply them and pick the coefficient of $\displaystyle x^d$. Then sum over $\displaystyle k$