Ways in which 38 can be divided into 3 positive parts such that the first is divisible by 8, the second by 7 and the third part by 3? I am stuck with the question, i have tried a couple of random approaches but none of them is correct. The answer is 2. Please help if you know how to solve this question.
 A: Assuming that each part must be an integer, this is equivalent to the number of non negative integral solutions of
$$8x+7y+3z=38$$
We have $x,y,z\ge1$. So, let $a=x-1,b=y-1,c=z-1$ such that $a,b,c\ge0$.
Then,
$$8a-8+7b-7+3c-3=38$$
$$8a+7b+3c=56$$
Let $X=8a,Y=7b,Z=3c$.
$$X+Y+Z=56$$
Allowed values of $X=0,8,16,24,32,40,48,56$.
Allowed values of $Y=0,7,14,21,28,35,42,49,56$.
Allowed values of $Z=0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54$.
Number of solutions=Coefficient of $x^{56}$ in the expansion of
$$(1+x^8+x^{16}+\cdots+x^{56})(1+x^7+x^{14}+\cdots+x^{56})(1+x^{3}+x^6+\cdots+x^{54})$$
that is coefficient of $x^{56}$ in
$$\left(\frac{1-x^{64}}{1-x^8}\right)\left(\frac{1-x^{63}}{1-x^7}\right)\left(\frac{1-x^{57}}{1-x^3}\right)$$
which can be further simplified using binomial expansions.
Using this, you can find all possible solutions in general. In this case, however, trial and error may be more convenient.
A: Using the fact that second and third part should both be either even or odd, number of possibilities are reduced very much. For first part =8, 21,  9 are the solution.
For first part= 16, 7, 15 are the solution
