<s>[INST] Number of partitions of an integer with extra conditions In how many ways can you write number 15 as a sum of positive integers if number 1 can appear 3 times at most in the sum and number 3 can only appear even number of times?
I've tried doing this as $$(1+t+t^2+t^3)(1+t^2+t^4+t^6+t^8+t^{10}+t^{12}+t^{14})(1+t^6+t^{12})\cdots(1+t^{15})$$ and finding the coefficient of $t^{15}$, but it's taking too much time. Is there an easier way to do this? I think the result should be around 81. (I found the number of partitions of number 15 with no limitations, then ruled out those that do not satisfy the condition.)
 [/INST] Via inclusion-exclusion, where $p_n$ is the number of unrestricted partitions of $n$:
\begin{align}
& p_{15} 
- \left[p_{15-4\cdot1} + (p_{15-1\cdot3} - p_{15-2\cdot3}) + (p_{15-3\cdot3} - p_{15-4\cdot3}) + p_{15-5\cdot3} \right]
+ \left[(p_{15-4\cdot1-1\cdot3} - p_{15-4\cdot1-2\cdot3}) + p_{15-4\cdot1-3\cdot3} \right] \\ &= p_{15} 
- \left[p_{11} + (p_{12} - p_9) + (p_6 - p_3) + p_{0} \right]
+ \left[(p_8 - p_5) + p_{2}\right] \\
&= 176 
- \left[56 + (77 - 30) + (11 - 3) + 1 \right]
+ \left[(22 - 7) + 2\right] \\
&= 176 - 112 + 17 \\
&= 81
\end{align}
</s>