Suppose we have a vector $x=(x_0,x_1,x_2,\ldots,x_{n-1})$ with $x_i\in\{0,1,2\}$ for all $i=0,1,...,n-1$.
Define $$ x'=\sum_{i=0}^{n-1}x_i, $$ then $$ 0\leq x'\leq n\cdot 2.. $$
I would like to know how many possibilities of vectors there are, for fixed $0\leq m\leq n\cdot 2$, to have $$ x'=m. $$
I think, for example, for $x'=0$ and $x'=n\cdot 2$, we only have one possibility, namely $(0,...,0)$ and $(2,...,2)$. But maybe there is some general formula.
I don’t know whether there is some Trick.