# 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*}$$
• So the value of let's say $a_5$ is the coefficient of $x^5$ in the generating function? – user747644 Feb 14 '20 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 '20 at 13:37