Got this selection of M&Ms out of the candy dispenser at work the other
day and spent the next 20 minutes trying to...
Got this selection of M&Ms out of the candy dispenser at work the other day and spent the next 20 minutes trying to work out the probability of receiving this exact distribution. Still not entirely sure. #nerdlife
John Bump Well, you'd at least have to know how the colors are distributed (what proportions they're in). Then, you could just assume the jar has infinite pieces in it (so that removing one wouldn't alter the overall proportions) and you'd probably still be OK...the jar probably has several hundred in it. But it turns out that the colors aren't equally likely to appear in a bag...brown is the least common. That surprised me.
You also have to make an assumption about how many candies get dispensed. I have no idea about what that is except to say that it typically runs between 5 and 8, inclusive.
Sam Hetchler Wow...I had totally forgotten that. This photo came up in Google Photos yesterday and I was like "Oh, right, I wanted to post about that," and completely did not remember posting about it before. Sucks to have a terrible memory (inherited...a family trait), but I appreciate you pointing it out. I also really like your solution, but you're overestimating the probability because there's no guarantee you'll get exactly six M&Ms each time. If you assume a uniform distribution (for convenience) between 5 and 8 (inclusive) candies, then you'd have 1/4 the likelihood of getting this...about 0.36% of the time. Thanks again, and sorry for not remembering I'd posted this before. The "absent-minded professor" trope strikes again!
I can't tell you how many times I've done something interesting and done a google search and found a g+ post of mine, where I was talking about having done almost exactly the same thing x years ago...
Sam Hetchler Ha ha, no...not by a long shot. Although I have to admit that a lot of my social media time lately has been spent leading up to the launch of my game company's newest game over on Kickstarter. Plus, I've gone on a bit of a news diet...the constant, crushing Sturm und Drang coming out of Washington was doing terrible things to my mental health.
Wouldn't you have to know how many are in the dispenser?
ReplyDeleteJohn Bump You're deviating from the question :)
ReplyDeleteJohn Bump Well, you'd at least have to know how the colors are distributed (what proportions they're in). Then, you could just assume the jar has infinite pieces in it (so that removing one wouldn't alter the overall proportions) and you'd probably still be OK...the jar probably has several hundred in it. But it turns out that the colors aren't equally likely to appear in a bag...brown is the least common. That surprised me.
ReplyDeleteApproximately 1:120.
ReplyDeleteAl Middleton You'll need to show your work for full credit.
ReplyDeleteI beg for extension, certain this has precise answer.
ReplyDeleteYou also have to make an assumption about how many candies get dispensed. I have no idea about what that is except to say that it typically runs between 5 and 8, inclusive.
ReplyDeleteHey Craig Froehle, you did this exact same thing last year (June 9th, 2016: https://plus.google.com/+CraigFroehle/posts/2vRbNJJFfH1). Looks like the same picture even.
ReplyDeleteHe's my write up: deltainnovativelabs.wordpress.com - Calculating odds of M&M pulls using PLSQL
TL;DR: 1.43% of the time you'll get this distribution.
Sam Hetchler he's recycling content?
ReplyDeleteJohn Lewis First time I've seen him do it. Not even a h/t to the old content. Maybe he forgot? I quite enjoyed the code I made, so I didn't forget it.
ReplyDeleteSam Hetchler I like your solution.
ReplyDeleteJohn Lewis Thanks! I had fun doing it.
ReplyDeleteSam Hetchler Wow...I had totally forgotten that. This photo came up in Google Photos yesterday and I was like "Oh, right, I wanted to post about that," and completely did not remember posting about it before. Sucks to have a terrible memory (inherited...a family trait), but I appreciate you pointing it out. I also really like your solution, but you're overestimating the probability because there's no guarantee you'll get exactly six M&Ms each time. If you assume a uniform distribution (for convenience) between 5 and 8 (inclusive) candies, then you'd have 1/4 the likelihood of getting this...about 0.36% of the time. Thanks again, and sorry for not remembering I'd posted this before. The "absent-minded professor" trope strikes again!
ReplyDeleteI can't tell you how many times I've done something interesting and done a google search and found a g+ post of mine, where I was talking about having done almost exactly the same thing x years ago...
ReplyDeleteCraig Froehle you can adjust the code to give you the different amounts. I believe we were assuming a constant amount last year.
ReplyDeleteNo worries about the second post. I was curious as to why your posting MO changed. It would make me very sad if you were done with new content.
And of course, adjustments to the proportions need to be made if Van Halen is in the area. :)
ReplyDeleteAnd the yellow one has a birth defect. I want to see that in there, too, math nerds! 😉
ReplyDeleteSam Hetchler Ha ha, no...not by a long shot. Although I have to admit that a lot of my social media time lately has been spent leading up to the launch of my game company's newest game over on Kickstarter. Plus, I've gone on a bit of a news diet...the constant, crushing Sturm und Drang coming out of Washington was doing terrible things to my mental health.
ReplyDelete