This week the question is: Can You Solve the Tricky Mathematical Treat?
It’s Halloween time! While trick-or-treating, you encounter a mysterious house in your neighborhood.
You ring the doorbell, and someone dressed as a mathematician answers. (What does a “mathematician” costume look like? Look in the mirror!) They present you with a giant bag from which to pick candy, and inform you that the bag contains exactly three peanut butter cups (your favorite!) [no, it isn’t!], while the rest are individual kernels of candy corn (not your favorite!).
You have absolutely no idea how much candy corn is in the bag—any whole number of kernels (including zero) seems equally possible in this monstrous bag.
You reach in and pull out a candy at random (that is, each piece of candy is equally likely to be picked, whether it’s a peanut butter cup or a kernel of candy corn). You remove your hand from the bag to find that you’ve picked a peanut butter cup. Huzzah! [Yuck!]
You reach in again and pull a second candy at random. It’s another peanut butter cup! You reach in one last time and pull a third candy at random. It’s the third peanut butter cup! [Triple yuck!]
At this point, whatever is left in the bag is just candy corn. How many candy corn kernels do you expect to be in the bag?

Highlight to reveal (possibly incorrect) solution:
First let’s assume there is a finite number of kernels of candy corn (kcc), at most m. What is the probability I got 3 peanut butter cups (pbc) (and yuck)?
- If I have n kcc, that’s 3+n pieces of candy in all. How many different ways can they be sorted? This is a stars and bars question, and the answer is C(3+n n) = (3+n)!/n!3!
- Of these (3+n)!/n!3! permutations, only 1 is any good, because it has the 3 pbc at the top.
- P(3 pbc | n kcc) = 1 / (3+n)!/n!3! = n!3!/(3+n)!
- n has m+1 different possible values.
- P(n kcc) = 1 / (m+1)
- P(3 pbc) = sum of all P(3 pbc | n kcc) * P(n kcc)
- Use Bayes’ theorem.
- P(n kcc | 3 pbc) = P(3 pbc | n kcc) * P(n kcc) / P(3 pbc)
- The expected number (E) of kcc is the sum of all n * P(n kcc | 3 pbc).
- And I made a program to calculate that given m.
Varying m hopefully tells me something about the behavior of E. And yes, it seems to. When m grows, apparently E gets closer to 1. So my guess is the expected number of kernels of candy corn is 1.
Also, I’m still fascinated by the soup bowl last week. Here’s a video!