Sunday, July 23, 2017

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

18 comments:

  1. Wouldn't you have to know how many are in the dispenser?

    ReplyDelete
  2. John Bump You're deviating from the question :)

    ReplyDelete
  3. 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.

    ReplyDelete
  4. Al Middleton You'll need to show your work for full credit.

    ReplyDelete
  5. I beg for extension, certain this has precise answer.

    ReplyDelete
  6. 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.

    ReplyDelete
  7. Hey 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.

    He'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.

    ReplyDelete
  8. Sam Hetchler he's recycling content?

    ReplyDelete
  9. John 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.

    ReplyDelete
  10. Sam Hetchler I like your solution.

    ReplyDelete
  11. 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!

    ReplyDelete
  12. 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...

    ReplyDelete
  13. Craig Froehle you can adjust the code to give you the different amounts. I believe we were assuming a constant amount last year.

    No 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.

    ReplyDelete
  14. And of course, adjustments to the proportions need to be made if Van Halen is in the area. :)

    ReplyDelete
  15. And the yellow one has a birth defect. I want to see that in there, too, math nerds! 😉

    ReplyDelete
  16. 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.

    ReplyDelete

Now I'm doubly intrigued!

Now I'm doubly intrigued!