M&Ms

I remember a time long ago, elementary school, when the school would hold a contest. There were different varieties of this contest but the basic version went as follows.

Guess the number of M&Ms contained in the jar. The person closest wins the jar!

The question is simple but to get anything better than a random guess, it’s best if we apply some mathematics.

First, we need to find the volume of container. We will assume that the jar is cylinder. Maybe it is 20 cm tall and 10 cm in radius. Therefore, the volume is calculated using the formula:

$V = \pi * r^2 * h = 3.14 * 10^2 * 20 = 6280 cm^3$

Now we need to find the volume of each M&M. A quick Google search gives us a volume of 0.636 cm3 for each M&M. Now we divide these two quantities to determine how many M&Ms fit in the container, 6280 / 0.636 = 9874.

However, this answer is too large. The above equation is assuming that the container is completely filled with M&Ms. If you look closely, you will see that there are little gaps between the pieces that are filled with air and not candy. To account for this, we need to take a quick detour.

Consider the following problem, how many of these circles can you fit into this square without overlapping?

Here is one attempt where I get 6 circles:

Here is one where I can get 7 circles:

The best packing I can get is 8 circles:

In this configuration, the circles take up 73% of the total area. We can use the same concept with the M&Ms. For packing circular objects into a container, the percentage is 64%. This means that we have a total of:

9874 * 64% = 9874 * 0.64 = 6319

There you have it, there should be 6319 M&Ms. Next time you are guessing at the jar, use a little math.