<s>[INST] Counting integral solutions Suppose $a + b + c = 15$
Using stars and bars method, number of non-negative integral solutions for the above equation can be found out as $15+3-1\choose15$ $ =$ $17\choose15$
How to extend this principle for finding number of positive integral solutions of
$a + b + 3c = 15$?
I tried to do it by substituting $3c$ with another variable $d$. But could not succeed.
 [/INST] The generating function for the number of non-negative integral solutions to $a+b+3c=n$ is
$$
f(x)=\frac1{1-x}\frac1{1-x}\frac1{1-x^3}
$$
Since
$$
\begin{align}
(1-x)^{-2}
&=\sum_{k=0}^\infty\binom{-2}{k}(-x)^k\\
&=\sum_{k=0}^\infty\binom{k+1}{k}x^k\\
&=\sum_{k=0}^\infty(k+1)x^k
\end{align}
$$
and
$$
\begin{align}
\left(1-x^3\right)^{-1}
=\sum_{k=0}^\infty x^{3k}
\end{align}
$$
the coefficient of $x^n$ in $f(x)$ is
$$
\begin{align}
\sum_{k=0}^{\lfloor n/3\rfloor}(n-3k+1)
&=(n+1)\left(\lfloor n/3\rfloor+1\right)-\frac32\left(\lfloor n/3\rfloor+1\right)\lfloor n/3\rfloor\\
&=\left(n+1-\frac32\lfloor n/3\rfloor\right)\left(\lfloor n/3\rfloor+1\right)
\end{align}
$$
For $n=15$, we get $51$ ways.
</s>