Find Number of Non negative integer solutions of $x+2y+5z=100$
My attempt:
we have $x+2y=100-5z$
Considering the polynomial $$f(u)=(1-u)^{-1}\times (1-u^2)^{-1}$$
$\implies$
$$f(u)=\frac{1}{(1-u)(1+u)}\times \frac{1}{1-u}=\frac{1}{2} \left(\frac{1}{1-u}+\frac{1}{1+u}\right)\frac{1}{1-u}=\frac{1}{2}\left((1-u)^{-2}+(1-u^2)^{-1}\right)$$
we need to collect coefficient of $100-5z$ in the above given by
$$C(z)=\frac{1}{2} \left((101-5z)+odd(z)\right)$$
Total number of solutions is
$$S(z)=\frac{1}{2} \sum_{z=0}^{20} 101-5z+\frac{1}{2} \sum_{z \in odd}1$$
$$S(z)=540.5$$
what went wrong in my analysis?
An alternative way.
Given $x+2y+5z=100$ and it is clear that $0\le z\le20$.
For any possible values of $z$, $x+2y=100-5z$.
Let us take $p=100-5z\ge0$. Solving the equation $x+2y=p$, $(-p,p)$ is a solution. The general solution of $(x,y)$ is $$x=-p+2q,\ \ y=p-q,\ \ q\in\mathbb{Z}$$
If $p=2k$, then $k=\dfrac p2\le q\le p=2k$.
So, there are $k+1=\dfrac p2+1$ solutions for $(x,y)$
So, we have the following numbers as follows $$p=100,95,90,85,80,75,......,15,10,5,0$$and$$k+1=51,48,46,43,41,38,......,8,6,3,1$$
The total number of solutions are $$4(10+20+30+40)+5(8+6+3+1)+51=541$$