# How many solutions are to $x_1+x_2+x_3+x_4+x_5+x_6=30$ if $x_1=6$ then $x_2\neq 4$, $x_3=6$ then $x_4\neq 4$, $x_5=6$ then $x_6\neq 4$?

How many solutions over $\mathbb N$ (includes $0$) are to $x_1+x_2+x_3+x_4+x_5+x_6=30$ if the three conditions below must hold:

if $x_1=6$ then $x_2\neq 4$, if $x_3=6$ then $x_4\neq 4$, if $x_5=6$ then $x_6\neq 4$?

I thought to use inclusion/exclusion principle here. In general there're ${30-1+6\choose 30}$ solutions.

We can count how many solutions are if $x_i=6\land x_{i+1}=4$ for $i=1,3,5$. There're ${20-1+4\choose 20}$ solutions.

If two "anti-conditions" hold together then there're ${10-1+2\choose 10}$ and if all three "anti-conditions" hold then there's only one solution.

Therefore the final answer is: $${30-1+6\choose 30}-3{20-1+4\choose 20}+3{10-1+2\choose 10}-1=319351$$

I'm not sure this is correct application of inclusion/exclusion principle here.

• the idea looks right to me – gt6989b Jun 27 '18 at 12:30

if $$x_1+x_2+x_3+x_4+x_5+x_6 = 30$$ and $$x_1 = x_3 = x_5 = 6$$ $$x_2+x_4+x_6 = 30 -6×3$$ $$x_2+x_4+x_6 = 12$$ where $$x_2 ≠ x_4 ≠ x_6 ≠ 4$$
• That is the situation if all of $x_1,x_3,x_5$ equal $6$. But they may take different values. – Andrew Woods Jun 27 '18 at 16:38