Number of solutions to $x+y+z = n$ 
If $\beta(n)$ is the number of triples $(x, y, z)$ such that $x + y + z = n$ and $0 \le z \le y \le x$, find $\beta(n)$.

Attempt:
I think there are many cases to look at to find $\beta(n)$. We know that the number of solutions without restriction is $\binom{n+2}{2}$, but we need one ordering. The number of solutions $0 \leq z \leq y \leq x$ is the same as the number of solutions $0 \leq y \leq x \leq z$, etc. Thus, we just need to worry about the case that $x=y=z$ since this is the only case they'll intersect. If $n$ is divisible by $3$, then $\beta(n) = \dfrac{\binom{n+2}{2}-1}{3}+1$ and otherwise $\dfrac{\binom{n+2}{2}}{3}$.
 A: Let $a=z$, $b=y-z$, $c=x-y$. We are looking for the number of solutions of $c+2b+3a=n$ with $a,b,c\geq 0$, so the answer is given by:
$$[x^n](1+x+x^2+x^3+\ldots)(1+x^2+x^4+x^6+\ldots)(1+x^3+x^6+x^9+\ldots)$$
i.e. by:
$$ [x^n]\frac{1}{(1-x)(1-x^2)(1-x^3)} \tag{1}$$
that can be recovered through partial fraction decomposition. The meromorphic function $f(z)=\frac{1}{(1-z)(1-z^2)(1-z^3)}$ has a triple pole at $z=1$ and simple poles at $z\in\{-1,\omega,\omega^2\}$, so we know in advance that $(1)$ behaves like a $\color{green}{\text{second-degree polynomial in }n}$ plus $\color{blue}{\text{a small perturbation}}$ that depends on $n\pmod{6}$. Using the residue theorem we get:
$$ f(x) = \frac{17}{72}\cdot\frac{1}{(1-x)^3}+\frac{1}{8}\cdot\frac{1}{x+1}+\frac{1-i\sqrt{3}}{18}\cdot\frac{1}{x-\omega}+\frac{1+i\sqrt{3}}{18}\cdot\frac{1}{x+\omega}\tag{2} $$
hence:
$$ (1) = \frac{1}{72} \left(\color{green}{6n^2+36n+47}+\color{blue}{9 (-1)^n+4\cos\frac{2\pi n}{3}}\right)\tag{3}$$
and the answer is given by the closest integer to $\color{red}{\large\frac{(n+2)(n+4)}{12}}$.
