Cookie Monster Problem

(Richard Guy in the Inquisitive Problem Solver, 2002)

The cookie monster is hungry. Thankfully there are automated cookie jars close by. Each minute he can name a number and each cookie jar will dispense that many cookies if possible. How should he empty the cookie jars as quickly as possible?

We start with 7 jars containing 1-7 cookies respectively. It can be solved with three number guesses. Those children who manage to find a way to do it automatically get upgraded to 15 cookie jars with 1-15 cookies respectively.

After seeing the beautiful pattern that results, consider experimenting by seeding several jars with numbers under 20 (the numbers chosen by the class.) Now you won’t know the optimal result, but you can all strive together to help the cookie monster.

As a mathematician I wonder if the minimum number of guesses is ever different with a greedy cookie monster. For example, with the seven jars using 1-7 cookies respectively: {1,2,3,4,5,6,7}, if you tell the cookie monster “2” he will greedily take two cookies from every jar except the 1 to give {1,0,1,2,3,4,5}. If the next guess is “4” the cookie monster will greedily take from the rightmost two jars: {1,0,1,2,3,0,1}. If the last guess is “1” you can see that two jars are still full: {0,0,0,1,2,0,0}. With a greedy cookie monster the order of guesses matters. “2” then “4” then “1” fails. The only way to solve {1,2,3,4,5,6,7} in three guesses is to first guess “4” then “2” then “1.”

The minimum number of guesses can be different for a greedy cookie monster. For example: {2,3,4,5,6,7,9} can be solved efficiently in just three days by taking 2 from {2,5,6,9} and then 3 from the jars that originally contained {3,5,7,9} and 4 from {4,6,7,9}. If the monster is greedy and takes from every possible jar, this doesn’t work. Starting with 2, you’d end up with {}-2 = {0,1,2,3,4,5,7} which requires three additional guesses.

Mathematics is the most beautiful and most powerful creation of the human spirit.

Stefan Banach

Standards for Mathematical Practice

MathPickle puzzle and game designs engage a wide spectrum of student abilities while targeting the following Standards for Mathematical Practice:

MP1 Toughen up!

This is problem solving where our students develop grit and resiliency in the face of nasty, thorny problems. It is the most sought after skill for our students.

MP3 Work together!

This is collaborative problem solving in which students discuss their strategies to solve a problem and identify missteps in a failed solution. MathPickle recommends pairing up students for all its puzzles.

MP6 Be precise!

This is where our students learn to communicate using precise terminology. MathPickle encourages students not only to use the precise terms of others, but to invent and rigorously define their own terms.

MP7 Be observant!

One of the things that the human brain does very well is identify pattern. We sometimes do this too well and identify patterns that don't really exist.


Please use MathPickle in your classrooms. If you have improvements to make, please contact us. We'll give you credit 😉

Gordon Hamilton

(MMath, PhD)


Lora Saarnio