How many ways to fill the bag with fruits?

You have to fill a large bag with 2018 fruits—apples, bananas, cantaloupes, durians, and raspberries—under the following restrictions:

  • The number of apples must be a multiple of 41.
  • The number of bananas must be even.
  • There cannot be more than 40 cantaloupes.
  • There cannot be more than one durian (for obvious reasons).

How many different ways are there to fill the bag?

Note : This problem can be solved without having to grind all the possibilities. Generating functions may help you.


The answer is 2039190.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Any filling of the bag can be described uniquely by three non-negative integers,

  • x x = total number of apples + cantaloupes,

  • y y = total number of bananas + durians,

  • z z = total number of raspberries.

Note that each value of x x gives a unique number of apples and cantaloupes ( x = 41 a + c x = 41a + c ), and similarly y y gives a unique number of bananas and durians ( y = 2 b + d y = 2b + d ).

The constraint x + y + z = 2018 x + y + z = 2018 can be viewed as placing 2018 "stars" in a line and separating them anywhere with 2 "bars". Thus we must choose two out of 2018 + 2 2018 + 2 possible locations for the bars; the number of possibilities is ( 2018 + 2 2 ) = 1 2 2020 2019 = 1010 2019 = 2 019 000 + 20 190 = 2 039 190 . \binom{2018+2}2 = \tfrac12\cdot 2020\cdot 2019 = 1010\cdot 2019 = 2\,019\,000 + 20\,190 = \boxed{2\,039\,190}. (No calculators were touched in the process.)

I believe your (second to) last line is incorrect. 1010 x 2019 already equals 2039190. Where does the extra 20190 come from?

James Jensen - 2 years, 10 months ago

Log in to reply

I split it as ( 1000 + 10 ) × 2019 = 1000 × 2019 + 10 × 2019 , (1000 + 10) \times 2019 = 1000\times 2019 + 10\times 2019, etc.

Arjen Vreugdenhil - 2 years, 10 months ago

Log in to reply

I understand. If I were doing it I would either leave that second to last step out or add another step before it (e.g. your reply above.

James Jensen - 2 years, 10 months ago

That intermediate step, along with the parenthetical comment at the end, is probably just in response to a comment criticizing my solution as being "too calculative" (a criticism I still don't understand, but oh well).

If you do it the way Arjen shows, the multiplication is trivial, so the only calculation of any substance is the final addition, which is still easy to do.

Brian Moehring - 2 years, 10 months ago

3 + 8 + 2001 = my birthday x + y + 20ZD = my final day so my life = ⏰? assume: death is imminent : death is unpredictable : death looks at you every day waiting for an order : you live in africa : you love mathematics : you are using this app obsessively thinking you will change who you are. ANSWER : don't waste your time solving problems that were solved hundreds of years ago, our life is shorter than we think . start studying offline ,buy books,learn languages, play music and have fun . Tip: using your mind too much is a psychological disorder called OCD . I mean a black dog, a nightmare ,insomnia and depression . they all are capable of killing you ! believe me a disease in the brain makes you insane so when we overload our brains with unnecessary trivial things . it collapses over it self like a dead star then explode or turn to a black hole . you don't wanna be a black hole, do you ?

Omar Khalifa - 2 years, 10 months ago

Log in to reply

An unusual comment.

"You live in Africa." True for you, not for me.

Solving problems that were solved hundreds of years ago is not a waste of time. The fact that we still think about these problems means that learning to solve them is probably important.

Your checklist:

[X] Study off-line. Most of what I post here is the result of off-line study.
[X] Buy books. I have 2000 books, most of them read. They cover math, science, language, theology, and more.
[X] Learn languages. I read about 15 languages, at various levels of proficiency, and converse in about 6. Arabic is in the making, as is first-century Coptic.
[X] Play music. Absolutely. Gimme a piano or organ, or guitar. Lots of math and science in the music, too.


"Using your mind too much is ... OCD." Not necessarily. OCD is using your mind too much in a particular way.

I hope you do not suffer of nightmares, insomnia, depression, or collapsing like a dead star.

Arjen Vreugdenhil - 2 years, 10 months ago

Log in to reply

Mr.Arjen( nice name by the way ) this "comment" is not unusual - with all due respect - you made it personal unnecessarily by talking about yourself . it is just a message that fights atheism which is pretty common among you and us as well 😢 . Not you in particular . you snubbed the death part of the comment . and that emphasizes my point of view . I KNOW THIS ANYWAY ! but I found you very remarkable on this site ,that's why I made this comment . I didn't have the opportunity to study advanced mathematics , I wish I had but I enjoy sharing my ideas with understanding people and improving my English too 😎.

Omar Khalifa - 2 years, 10 months ago

Log in to reply

@Omar Khalifa This is a place where people come and talk about mathematics, not about the Big Questions about life, death, God, good and evil, salvation, and so on. Your point is worthy of a discussion, but not here.

Personally, I too am concerned about atheism, and I love to talk to people and show them that there is a way out of the futility of life and death, a way to Eternal Life. Some of the people I talk with I know through this Brilliant site. But we have those discussions through Facebook or e-mail, not here. There is a proper place for everything.

Arjen Vreugdenhil - 2 years, 10 months ago

I was going to reply, but I think you have covered the aspects I would have commented upon.

James Jensen - 2 years, 10 months ago

Impressive

Zoe Codrington - 2 years, 9 months ago

I believe you are incorrect since we all know that it should be 2018+1 possible locations for the bars instead of 2018+2 possible locations. Moreove, both bars can be put together in one position.

Shi liuyun - 2 years, 10 months ago

Log in to reply

Following this article , we have:

The number of ways to place n n indistinguishable balls into k k labelled urns is ( n + k 1 k 1 ) . \binom{n+k-1}{k-1}. \ _\square

Our problem is equivalent to placing n = 2018 n = 2018 indistinguishable items into k = 3 k = 3 labelled urns ( x , y , z x, y, z ), so that we have ( 2018 + 3 1 3 1 ) \binom{2018+3-1}{3-1} ways of doing so.

Arjen Vreugdenhil - 2 years, 10 months ago

sadly i did not get this problem, i should have been wary of the 41 40, 2 1 pair

A Former Brilliant Member - 2 years, 10 months ago

Log in to reply

Not pair, combination.

Zoe Codrington - 2 years, 9 months ago

Log in to reply

I mean the 41 and 40 can be grouped together as a pair that can be equal to all numbers in 1 way and so can the 2 and 1

A Former Brilliant Member - 2 years, 9 months ago

This solution is a clever use of partitioning motivated by the fact that raspberries can be used to fill out the remaining space in the bag and the coprimality of the pairs put together as x x and y y that allows us to uniquely determine those quantities once x , y x,y are known. Really like it.

Gabriele Manganelli - 2 years, 10 months ago

Just one word:

Wow

Zoe Codrington - 2 years, 9 months ago
Brian Moehring
Jul 30, 2018

The generating functions for...

  • ... the number of ways to choose n n apples is 1 + x 41 + x 82 + = 1 1 x 41 1 + x^{41} + x^{82} + \cdots = \dfrac{1}{1-x^{41}}
  • ... the number of ways to choose n n bananas is 1 + x 2 + x 4 + = 1 1 x 2 1 + x^2 + x^4 + \cdots = \dfrac{1}{1-x^2}
  • ... the number of ways to choose n n cantaloupes is 1 + x + x 2 + + x 40 = 1 x 41 1 x 1 + x + x^2 + \cdots + x^{40} = \dfrac{1-x^{41}}{1-x}
  • ... the number of ways to choose n n durians is 1 + x 1+x
  • ... the number of ways to choose n n raspberries is 1 + x + x 2 + = 1 1 x 1 + x + x^2 + \cdots = \dfrac{1}{1-x}

It follows that the generating function for the number of ways to choose n n pieces of fruit is the product ( 1 1 x 41 ) ( 1 1 x 2 ) ( 1 x 41 1 x ) ( 1 + x ) ( 1 1 x ) = 1 ( 1 x ) 3 = n = 0 ( n + 2 2 ) x n \left(\frac{1}{1-x^{41}}\right)\left(\frac{1}{1-x^2}\right)\left(\frac{1-x^{41}}{1-x}\right)\left(1+x\right)\left(\frac{1}{1-x}\right) = \frac{1}{(1-x)^3} = \sum_{n=0}^\infty \binom{n+2}{2}x^n so the number of ways to fill the bag with 2018 2018 pieces of fruit is ( 2018 + 2 2 ) = 2039190 \binom{2018+2}{2} = \boxed{2039190}


Notes :

  • For those who haven't seen it before, I have used the identity 1 ( 1 x ) k + 1 = n = 0 ( n + k k ) x n \frac{1}{(1-x)^{k+1}} = \sum_{n=0}^\infty \binom{n+k}{k} x^n which can be shown by induction by starting with 1 1 x = n = 0 x n \frac{1}{1-x} = \sum_{n=0}^\infty x^n and taking k k th-order derivatives.
  • One way to avoid generating functions is to note that we can have any number of apples+canteloupes, and for each number there is precisely one way to do it using these two fruits. Similarly, we can have any number of bananas+durians, and for each number there is precisely one way to do it. Then the problem becomes equivalent to the one where we have three fruit types and no restrictions. That is, we would just need to find the number of non-negative integer solutions to a + b + c = 2018 , a+b+c = 2018, which in turn can be counted with stars and bars to be ( 2018 + 3 1 3 1 ) \binom{2018+3-1}{3-1}

Nice solution but too calculative.It made me use my calculator.

D K - 2 years, 10 months ago

Log in to reply

I'm honestly confused with your comment. Aside from the final step of computing ( 2020 2 ) , \binom{2020}{2}, where would a calculator even help?

Brian Moehring - 2 years, 10 months ago

Log in to reply

It will I have a scientific one

D K - 2 years, 10 months ago

It will work easily

D K - 2 years, 10 months ago

Try yourself only

D K - 2 years, 10 months ago

I totally forgot about raspberries because they weren't among the restrictions and ended up with generating function 1 ( 1 x ) 2 . \dfrac{1}{(1-x)^{2}}.

Uros Stojkovic - 2 years, 10 months ago

Log in to reply

I actually did the same thing on my first attempt; then had to re-read the problem when I was told the answer wasn't 2019 2019

Brian Moehring - 2 years, 10 months ago

Log in to reply

I made some silly mistakes on my first two attempts and when I finally made sure everything in my calculations was okay, I was shocked to find out that I forgot about one type of fruit… Never mind

Uros Stojkovic - 2 years, 10 months ago

My answer with all restrictions on fruits a,b,c and d is 2019. However, raspberrys is not mentioned in the conditions and completely missed. The problem without raspberrys is more challenging.

Vinod Kumar - 2 years, 10 months ago

Log in to reply

It definitely is easy to miss the raspberries in the initial list by just skipping to the bullet-point restrictions. As I mentioned in another comment thread, even I missed it initially.

Brian Moehring - 2 years, 10 months ago

It is good

Supriya Manna - 2 years, 9 months ago
Amil Dravid
Aug 12, 2018

Let us create a generating function for each restriction.

apples: (1+x^41+x^82+...)=1/(1-x^41) bananas: (1+x^2+x^4+...)=1/(1-x^2) cantaloupes: 1+x+x^2+...x^41= (x^41-1)/(x-1) durian: (1+x) raspberries: 1+x+x^2+...=1/(1-x)

When we multiply these, we obtain -1/(x-1)^3.

We want the coefficient of x^2018, which we can obtain by the negative binomial theorem:

  • 2018+3-1 choose 2018= 2039190.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...