I have a field of 1 x n size. I need to color it using: red, orange, green, blue. Also, I can color red only even amount of blocks, and orange only odd amount of blocks.
Finally I need to find a generating function describing how many combinations of different colors I can use.
How can I do it?
If order doesn’t matter, you’re looking at partitions of $n$ into four parts labelled red, orange, green, and blue, where any of the parts except the orange part can be empty, the red part must be even, and the orange part must be odd. Look at the coefficient of $x^n$ in the product
$$\begin{align*} &\underbrace{(1+x^2+x^4+\ldots)}_{\text{red}}\underbrace{(x+x^3+x^5+\ldots)}_{\text{orange}}\underbrace{(1+x+x^2+\ldots)}_{\text{green}}\underbrace{(1+x+x^2+\ldots)}_{\text{blue}}=\\\\ &\left(\sum_{n\ge 0}x^{2n}\right)\left(\sum_{n\ge 0}x^{2n+1}\right)\left(\sum_{n\ge 0}x^n\right)\left(\sum_{n\ge 0}x^n\right)\;. \end{align*}$$
All of these summations have simple generating functions.