Cute little math puzzle

Muse

Lifer
Jul 11, 2001
39,888
9,590
136
I just bought a big jar of Jelly Belly jelly beans at Costco. There are 49 flavors. Assuming that there are equal numbers of each flavor, how many beans do I have to eat before it becomes likely that I've eaten two beans of the same flavor?

There's actually 1.814 Kg of these beans in the jar and they say that 35 of them are about 40 grams. But for the sake of this puzzle, let's just assume it's a real big (infinite) vat of jelly beans, and you aren't diminishing the chance of pulling a watermelon flavored bean just because you already ate one.


 

Soccerman06

Diamond Member
Jul 29, 2004
5,830
5
81
you cant do this if there are infinite beans, 1/49 to get it the first time, but you cant do the second one because theres an infinite amount of beans and you cant tell the % left over in the vat: (1/49)(infinite)

Say you have 1/49 chance of getting it the first time, and 1/49 the second time (considering you put the bean back in the vat)

.0416493% chance to find the bean the 2 times but you cant figure the correct amount because of the vat's size, the less of a chance of getting: (1/98)(1/97) = .0105196% and so on until you get to (1/infinite)(1/(infinite-1)) which turns into (1/(infinite^2 - infinite)) so:
Lim---------(1/(infinite^2 - infinite))=0
X-->infinite
 

Muse

Lifer
Jul 11, 2001
39,888
9,590
136
No, it's easier if you figure there's an infinite number of beans. It's doable either way, though. If infinite, you only have to consider the chance of each bean as you select it being the same flavor as one of the previous ones and readjust your odds until you get to the point where you've probably had a duplicate. Every time you pick a bean it has to be one of the 49 possible flavors.

No, you don't put any beans back in the vat. You eat it! Wasn't I clear on that?

I actually think it's something like this:

48/49 chance on the second bean that it isn't a duplicate.

On 3rd bean, the chance that you haven't a duplicate is 48x47/49x49 =.94

On 4th bean, it's 46x47x48/49x49x49 = .88

and so forth until

On 8th bean it's 0.5482

On the 9th bean it's 0.458

So, you have probably eaten at least two beans of the same flavor when you eat your 9th bean.

BTW, I love Jelly Belly's.
 

sao123

Lifer
May 27, 2002
12,653
205
106
So just eat 50. Guaranteed you have eaten at least 2 of a certain flavor.
 

Soccerman06

Diamond Member
Jul 29, 2004
5,830
5
81
Originally posted by: Muse
No, it's easier if you figure there's an infinite number of beans. It's doable either way, though. If infinite, you only have to consider the chance of each bean as you select it being the same flavor as one of the previous ones and readjust your odds until you get to the point where you've probably had a duplicate. Every time you pick a bean it has to be one of the 49 possible flavors.

No, you don't put any beans back in the vat. You eat it! Wasn't I clear on that?

I actually think it's something like this:

48/49 chance on the second bean that it isn't a duplicate.

On 3rd bean, the chance that you haven't a duplicate is 48x47/49x49 =.94

On 4th bean, it's 46x47x48/49x49x49 = .88

and so forth until

On 8th bean it's 0.5482

On the 9th bean it's 0.458


So, you have probably eaten at least two beans of the same flavor when you eat your 9th bean.

BTW, I love Jelly Belly's.

My equation was the chances of picking a bean 2 times in a row. Your question is different than what I answered (yes i read it wrong).

Your thinking is also wrong. You cant have 2 beans of the same kind in a jar if theres 49 different kinds and only have 49 beans. There is only 1 of each kind of bean in the vat.

There is also another problem with your equations, the chance of finding the second bean in your equation is 1/40 (2.5%) at your 9th try.

To make your example possible, you would have to have 2 of each bean (98). So the chances of you finding the bean first is 2/98 (2.04%), if you picked wrong, it would be 2/97 (1.03%). On your 9th try, it would be 2/89 (2.25%). And so on, until you find the right bean, and the equation would change to 1/x.
 

Muse

Lifer
Jul 11, 2001
39,888
9,590
136
Originally posted by: BespinReactorShaft
Originally posted by: sao123
So just eat 50. Guaranteed you have eaten at least 2 of a certain flavor.

Winner.
No, that's a loser. In fact it's absolutely possible to eat every jelly bean in the vat except for one flavor, and do so if picking randomly. IOW, you could eat 48/49th's of the beans and still not eaten, say, a watermelon flavored bean. Very unlikely indeed, but possible. If that did happen, of course, there would be only watermelon flavored beans left.

Besides, the objective is not to eat 2 of the same flavor. Reread the OP. The objective here is to find out how many beans you have to eat until odds are that you have eaten at least two of the same flavor. I believe it's 9, as previously discussed (my last post).
 

Muse

Lifer
Jul 11, 2001
39,888
9,590
136
Originally posted by: Soccerman06
Originally posted by: Muse
No, it's easier if you figure there's an infinite number of beans. It's doable either way, though. If infinite, you only have to consider the chance of each bean as you select it being the same flavor as one of the previous ones and readjust your odds until you get to the point where you've probably had a duplicate. Every time you pick a bean it has to be one of the 49 possible flavors.

No, you don't put any beans back in the vat. You eat it! Wasn't I clear on that?

I actually think it's something like this:

48/49 chance on the second bean that it isn't a duplicate.

On 3rd bean, the chance that you haven't a duplicate is 48x47/49x49 =.94

On 4th bean, it's 46x47x48/49x49x49 = .88

and so forth until

On 8th bean it's 0.5482

On the 9th bean it's 0.458


So, you have probably eaten at least two beans of the same flavor when you eat your 9th bean.

BTW, I love Jelly Belly's.

My equation was the chances of picking a bean 2 times in a row. Your question is different than what I answered (yes i read it wrong).

Your thinking is also wrong. You cant have 2 beans of the same kind in a jar if theres 49 different kinds and only have 49 beans. There is only 1 of each kind of bean in the vat.

There is also another problem with your equations, the chance of finding the second bean in your equation is 1/40 (2.5%) at your 9th try.

To make your example possible, you would have to have 2 of each bean (98). So the chances of you finding the bean first is 2/98 (2.04%), if you picked wrong, it would be 2/97 (1.03%). On your 9th try, it would be 2/89 (2.25%). And so on, until you find the right bean, and the equation would change to 1/x.

I'm sorry, but you have misunderstood the puzzle. There are many many beans, for the sake of argument, infinite. There are only 49 flavors. It's really the same problem as the following:

Consider integers in base 10. How many integers between 0 and 9 do you have to choose before you have probably chosen two of the same? To make it actually the same problem you have to work in base 49 instead of base 10. But you get the idea (here for base 10):

209384 No duplicate integers
397505 Duplicate integers
349657 No duplicate integers
345760 No duplicate integers
559673 Duplicate integers
 

DrPizza

Administrator Elite Member Goat Whisperer
Mar 5, 2001
49,601
166
111
www.slatebrookfarm.com
I was going to guess "around 8 or 9" before I continued reading the thread.

I believe there is a relatively well known problem of the same type:
How many people have to be in a room before it's likely that two of them share the same birthday.

This one became famous/infamous after a guest tried to explain this problem to Johnny Carson. (the answer is only 23)
Johnny questioned to see how many people in the audience had the same birthday as himself... in an audience of 200, no one shared his birthday. The guest apparently didn't understand it either, since he didn't correct Johnny on his method.

 
Jun 22, 2004
126
0
0
Here is the formula to finding the answer to a generalized version problem:

n!
-----------
(n-k)!n^k , with n being the number of jelly beans and k being the number of flavors, in this case 49.

It really becomes confusing when you throw in that there is an equal number of flavors and that the bag has an infinite amount of beans.

But like sao123 said, if you eat 50 jelly beans you are guaranteed to eat 2 of the same flavor. If you eat 49 beans, worst case is youve eaten 1 of every flavor. The 50th will have to double up one of the flavors. Basic use of the pigeonhole principle.

 

DrPizza

Administrator Elite Member Goat Whisperer
Mar 5, 2001
49,601
166
111
www.slatebrookfarm.com
Originally posted by: Muse
No, it's easier if you figure there's an infinite number of beans. It's doable either way, though. If infinite, you only have to consider the chance of each bean as you select it being the same flavor as one of the previous ones and readjust your odds until you get to the point where you've probably had a duplicate. Every time you pick a bean it has to be one of the 49 possible flavors.

No, you don't put any beans back in the vat. You eat it! Wasn't I clear on that?

I actually think it's something like this:

48/49 chance on the second bean that it isn't a duplicate.

On 3rd bean, the chance that you haven't a duplicate is 48x47/49x49 =.94

On 4th bean, it's 46x47x48/49x49x49 = .88

and so forth until

On 8th bean it's 0.5482

On the 9th bean it's 0.458

So, you have probably eaten at least two beans of the same flavor when you eat your 9th bean.

BTW, I love Jelly Belly's.

tsk tsk. Order of operations. But, I assumed you meant there should be parentheses in there
You meant (48x47)/(49x49), right?

You used the best approach - using the complement of the probability...
As it didn't appear everyone understood your approach...

For anyone trying to work it the other way, from the matching end of things, then you'd have a lot of probabilities to add up: Just for 9 jellybeans, you'd need to add in the probability that 3 of them were the same, 4 of them were the same, that there were 2 pairs, etc. It'd be a pita that way.

So, instead, you calculated the probability that NONE match.
with 2 jellybeans, the probability that the second doesn't match the 1st is, as you said,
48/49 don't match. (and the complement, 1/49 is the probability that they match)

With 3 jellybeans, the probability of the second one not matching the first one is 48/49. The probability that the 3rd doesn't match the first 2 is 47/49. IF the assumption of a huuuuuge amount of jellybeans hadn't been made, then the 47/49 would be affected slightly (as would the 48/49) And, as we've all been taught, the probability of 2 independent events both happening is the product of the probabilities of each event happening, so, (48/49)*(47/49)

Now, grab a 4th jellybean. The probability that it's color doesn't match the first 3 is 46/49. So, the probability of picking 4 without a match is (48/49) * (47/49) * (46/49). However, the complement of this probability *isn't* the probability that exactly two match. It's the probability that at least 2 match - which is why your way is much easier than calculating all the possibilities for a match.

So, the probability of selecting 9 jellybeans w/o a match is
48/49*47/49*46/49*45/49*44/49*43/49*42/49*41/49 = (as you said) .457820336
Note: *I* don't need parenthesis when writing the calculation that way
The complement of that gives a 54% probability *of at least 1 pair* (could be 3 of a kind, or 4 of a kind, or 2 pairs, or 3 pairs, or 2 pairs and 3 of a kind, or...)


NOW, using your bag of jellybeans, 1.814 kg and about 35 jellybeans = 40 grams, I'll see how it works out...
1814 grams times 35jb/40gram = approximately 1587 jellybeans
divided by 49 = 32.4 of each color... I'll round off since you said the same amount of jellybeans per color Someone else can handle the random distribution of 49 flavors of jellybeans over 1587 jellybeans...

32 of each jellybean... So, we'll assume 1568 jellybeans
Probability that the 2nd picked doesn't match the first is
(there are 31 matching (one of that color was already picked), 1567 remaining)
1536/1567 (which is approximately 48/49 for comparison's sake)

probability that the 3rd doesn't match the first two (there are 62matching out of 1566 remaining - 1504 don't match)
1504/1566

probability that the 4th doesn't match the first two (there are 93 matching out of 1565 remaining, thus 1472 don't match out of the remaining 1565 jellybeans)
1472/1567

The probability of picking 9 in a row without a match is
1536/1567 * 1504/1566 * 1472/1565 *. . .* 1312/1560
= .468
So, there's a 53.15% probability that at least 2 will match after 9 jellybeans starting with the bag you purchased. The assumption made the math easier, but the result was the same.
(incidentally, the probability after 8 was about 45%)


----how's that for being bored?!

 

chcarnage

Golden Member
May 11, 2005
1,751
0
0
Good old decision tree... Muse's formula is right and I've calculated the same result

We can calculate this for a limited but equally distributed amount of jelly beans, too. I suck at math but for some reason I managed to understand basic combinatorics

1814*35/40/49= ca. 32 beans of each flavor

Now can somebody else please do the math?

Edit
Oh done already... yeah yeah the curse of tabbed browsing.
 

interchange

Diamond Member
Oct 10, 1999
8,023
2,875
136
You guys are looking at this the hard way and getting it wrong.

Think of it this way:
chance of succeeding by try X = 1 - chance of failing X consecutive times

The chance of failing X consecutive times is really easy: (chance of failure)^X

So:
Chance of getting a particular jelly bean by your Xth try = 1 - (48/49)^X

Solving for X using guess and check (could use a logarithm if you want to solve exactly):
X = 34:
Chance of getting a particular jelly bean by your 34th try = 1 - (48/49)^34 = 1 - .49606 = 50.394 %.

Add 1 for your first pick, and by the 35th pick, chances are likely that you have chosen the same jelly bean twice.

Rationally, 9 makes no sense if you consider there are 49 different flavors of jelly beans .
 

Muse

Lifer
Jul 11, 2001
39,888
9,590
136
Originally posted by: interchange
You guys are looking at this the hard way and getting it wrong.

Think of it this way:
chance of succeeding by try X = 1 - chance of failing X consecutive times

The chance of failing X consecutive times is really easy: (chance of failure)^X

So:
Chance of getting a particular jelly bean by your Xth try = 1 - (48/49)^X

Solving for X using guess and check (could use a logarithm if you want to solve exactly):
X = 34:
Chance of getting a particular jelly bean by your 34th try = 1 - (48/49)^34 = 1 - .49606 = 50.394 %.

Add 1 for your first pick, and by the 35th pick, chances are likely that you have chosen the same jelly bean twice.

Rationally, 9 makes no sense if you consider there are 49 different flavors of jelly beans .

DrPizza said: tsk tsk. Order of operations. But, I assumed you meant there should be parentheses in there. You meant (48x47)/(49x49), right?

Right, multiplications performed before the division.

Well, interchange, you seem to have misunderstood the problem. You are trying to determine how many jelly beans you would have to sample before you come up with a particular flavor, or so it appears. Reread the OP.

DrPizza did a great job, and kudos for thoroughness. And ninex had the right formula. Yes, it's a variant of that question of how many people have to be in a room until it's likely that at least two share the same birthday. Yes, it was a little lazy of me to assume an infinite vat of beans, but as your calculations show, DrPizza, the "fudge" was not very significant.

I do recommend those jelly beans. I was never crazy about jb's but these "gourmet jelly beans" are something else. I wonder where they get those flavors. I suppose most of them are artificial. I ate one last night and it cracked me up, really made me laugh. It was peanut flavor.
 

Muse

Lifer
Jul 11, 2001
39,888
9,590
136
Originally posted by: DrPizza
Hey, thanks for this problem... I just used this problem in pre-calculus class, as well as the birthdays problem.

You're welcome! You teach that class? Cool!
 

ox1111

Junior Member
Sep 12, 2005
5
0
0
the answer for infinit beans is easy. the answer is 1 in 49. if the amount is so large not to deminish every pull is the same 1 in 49.
 

Muse

Lifer
Jul 11, 2001
39,888
9,590
136
Originally posted by: ox1111
the answer for infinit beans is easy. the answer is 1 in 49. if the amount is so large not to deminish every pull is the same 1 in 49.

You didn't read the OP very carefully. The puzzle is not to figure out the likelihood that the next bean is as the previous. Read it again. How many beans do you have to remove to a bowl (or your mouth) until you likely have at least two beans that are the same as one another. For example, if you've removed 5 beans, how likely is it that at least two of those beans are the same flavor. Come on, reading skills, people.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |