Counting the number of non-negative solutions of the equation $a_1+a_2+a_3+...+a_n=n,\ 0\leq a_i \leq i,\ 1\leq i \leq n-1 $ I am trying to count of the number of non-negative integer solution of the equation $$a_1+a_2+a_3+...+a_n=n$$ with the constraint
$0\leq a_i \leq i,\ 1\leq i \leq n-1.$
I guess we can use combinations with repetition. Is that a known problem? Is there a recurrence for this problem or closed-form formula?
 A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
By definition, the answer is given by
\begin{align}
\mathcal{A}_{n} & =
\bbox[10px,#ffd]{\sum_{a_{1} = 0}^{1}\sum_{a_{2} = 0}^{2}\ldots
\sum_{a_{n} = 0}^{n}\bracks{z^{n}}z^{a_{1}\ +\ a_{2}\ +\ \cdots\ + a_{n}}} =
\bracks{z^{n}}\prod_{k = 1}^{n}\sum_{a_{k} = 0}^{k}z^{a_{k}}
\\[5mm] & =
\bracks{z^{n}}\prod_{k = 1}^{n}{z^{k + 1} - 1 \over z - 1}
\end{align}
Explicitily,
$$
\mathcal{A}_{n} =
\bracks{z^{n}}\bracks{\vphantom{\Large A}\pars{1 + z}
\pars{1 + z + z^{2}}\ldots
\pars{1 + z + z^{2} + \cdots + z^{n}}}
$$

\begin{align}
\mbox{Lets}\quad
\mathcal{B}_{nk} & \equiv
\bracks{z^{n}}\bracks{\vphantom{\Large A}\pars{1 + z}
\pars{1 + z + z^{2}}\ldots\pars{1 + z + z^{2} + \cdots + z^{k}}}
\\[1mm] 
&\phantom{\equiv A}
\mbox{with}\ \mathcal{A}_{n} = \mathcal{B}_{nn}
\end{align}

$$
\mathcal{B}_{nk}\ \mbox{satisfies,}\quad
\mathcal{B}_{nk} =
\sum_{j = 0}^{k}\mathcal{B}_{n - j,\, k - 1}
$$
