Ted Pudlik bio photo

Ted Pudlik

Email Github

Cupcake puzzle

Consider a toy cupcake platter with five cupcakes. Each cupcake has three pieces: the cup, the cake, and the frosting. These pieces come in three different colors. The distribution of colors varies by piece:

  • Cups: two purple, two red, one blue
  • Cakes: one purple, two red, two blue
  • Frosting: two purple, one red, two blue
The cupcake puzzle.

The puzzle is to assemble all the cupcakes in such a manner that,

  1. No cupcake contains more than one piece in any color, and
  2. No piece is adjacent to a piece of the same color (e.g., next to a cupcake with blue frosting there are no other cupcakes with blue frosting).

At first glance it’s not obvious if the puzzle is even solvable, but in fact it is (see picture!).

But how many solutions are there?

It turns out that, of the 5400 arrangements, only two solve the puzzle. This is fewer than I expected. Colab with details.