Fruit basket

Task number: 3866

In how many ways can a basket be filled with \(n\) fruits under the following (somewhat unusual) conditions?

  • The number of apples must be even,
  • the number of bananas is divisible by five,
  • there are at most four oranges in the basket
  • and one or no pear.
  • Solution

    Generating functions for the numbers of individual types of fruits (a,b,o,p) are

    \(g_a(x)=x^0+x^2+x^4+… =\frac1{1-x^2}\),

    \(g_b(x)=x^0+x^5+x^{10}+… =\frac1{1-x^5}\),

    \(g_o(x)=x^0+x^1+x^2+x^3+x^4=\frac{1-x^5}{1-x}\) a

    \(g_p(x)=x^0+x^1=1+x\).

    The product of these functions gives the resulting generating function

    \(g(x)=g_a(x)g_b(x)g_o(x)g_p(x)= \frac1{1-x^2}\cdot\frac1{1-x^5}\cdot\frac{1-x^5}{1-x}(1+x)= \frac1{(1-x)^2}=1x^0+2x^1+3x^2+4x^3+5x^4+…\).

  • Answer

    A basket with \( n \) fruits can be assembled in \( n+1 \) ways.

Difficulty level: Easy task (using definitions and simple reasoning)
Routine calculation training
Cs translation
Send comment on task by email