Find the generating function for the sequence $a_n$ which counts the number of bags containing $n$ pieces of fruit in which there is an odd number of apples, at most $1$ banana, and at least $1$ orange. Find $a_{40}$.
I came up with the equation $(x+x^3+x^5...)(1+x)(x+x^2+x^3+...)$ for the three fruits. Simplifying, it becomes $x^2(\frac{1}{1-x^2})(\frac{1-x^2}{1-x})(\frac{1}{1-x})$ and then to $\frac{x^2}{(1-x)^2}$.
Assuming my formula is correct, do I find $a_{40}$ by plugging $40$ into the $x$'s?