# Create a generating function for a baskets with fruits

A basket holds 10 bananas, 8 apples, 6 oranges and 4 pears. Let $$a_i$$ be the number of different presents composed of $$i$$ fruits. Each such present contains at least 1 banana, at most 2 apples, the number of oranges in a present is even, and the number of pears in a present is odd. Create a generating function for $${\{{a_i\}}^\infty_{i=1}}$$.

I'm not really sure how to approach this problem, I'd appreciate any guidance.

The generating function $$\begin{eqnarray*} (b+b^2+\cdots+b^{10})(1+a+a^2)(1+o^2+o^4+o^6)(p+p^3) \end{eqnarray*}$$ will give the number of choices of fruits and keep tabs on which type of each fruit.

We are only intrested in the number of configurations for a given number of fruits, so let $$a=b=o=p=x$$ and we have $$\begin{eqnarray*} a_i= [x^i]:(x+x^2+\cdots+x^{10})(1+x+x^2)(1+x^2+x^4+x^6)(x+x^3). \end{eqnarray*}$$

• Shouldn't the sequance of a's start at 1 + a + ... etc and end at a^2, if there's at most 2 apples? – user747644 Feb 14 at 13:28
• @user747644 Yes. I had misread the question. Thank you for bringing this to my attention. – Donald Splutterwit Feb 14 at 13:31
• So the value of let's say $a_5$ is the coefficient of $x^5$ in the generating function? – user747644 Feb 14 at 13:34
• That's right. $[x^i]:f(x)$ is a coefficient extractor ... it means the coefficient of $x^i$ in the function $f(x)$. – Donald Splutterwit Feb 14 at 13:37