×   Home   Blog   Newsletter   Privacy   Contact Us   About

Painted Cube Puzzle

Here is a new painted cube puzzle. If you like this one, there’s two earlier variants: Painted Cube Puzzle #1, and Painted Cube Puzzle #2.


You have a collection of white unit cubes which you connect together to make a solid larger cube. Then, an unknown number of the sides of this larger cube are sprayed with red paint. After the paint has dried, the larger cube is deconstructed back into a pile of unit cubes. After deconstruction, you count and find that 240 of the small cubes have paint on exactly one face. How many of the unit cubes will you find with red paint on two faces?
How many of the unit cubes will you find with red paint on two faces?


The first problem to solve is determining how big the larger cube is.
Paint could have been applied to anywhere from [1-6] sides of the large structure. The catch is that, when painting multiple sides, it matters if the painted sides share a common edge. If they do, cubes on this common edge will received more than one dose of paint (two doses on an edge, and three if a corner). Unit cubes with more than one side painted do not qualify as one of the 240 cubes painted only on one side.

Let me count the ways

Without loss of generality, there are nine possible configurations of painting [1-6] sides of a cube.
  1. One face painted.
  2. Two, opposite, faces painted.
  3. Two, adjacent, faces painted.
  4. Three faces painted (that don’t meet in a corner).
  5. Three faces painted (that meet in a corner).
  6. Four faces painted (with two opposite sides clean).
  7. Four faces painted (with two adjacent sides clean).
  8. Five painted faces.
  9. Six painted faces.
Some of these can be hard to visualize, so I’ve drawn a net for each example, and for each, derived a formula for the number of single painted cubes that would be generated for that configuration (remember, common edges don’t count, and neither do common corners). In the diagrams below, the red shows the paint, but what we want to count is just the cubes that are singly painted!

#1 One face painted
SP = n×n

#2 Two, opposite, faces painted
SP = 2×(n×n)

#3 Two, adjacent, faces painted
SP = 2×n×(n-1)

#4 Three faces painted (no corner)
SP = [2×n×(n-1)] + [n×(n-2)]

#5 Three faces painted (corner)
SP = 3×(n-1)×(n-1)

#6 Four faces painted (opposite clean).
SP = 4×n×(n-2)

#7 Four faces painted (adjacent clean)
SP = [2×(n-1)×(n-2)] + [2×(n-1)×(n-1)]

#8 Five painted faces
SP = [(n-2)×(n-2)] + [4×(n-1)×(n-2)]

#9 Six painted faces
SP = 6×(n-2)×(n-2)

These formulas done, we can calculate the number of singly painted cubes for an increasing size of the larger cube. Here is a table of the results (we don’t need to go any higher than 16×16×16 as all cubes larger than this have ≥240 single painted unit cubes; irrespective of the number of painted faces). Each row shows an increasing value for n, and each column represents the class above.
As you can see, there is a distinct answer for 240 singly painted cubes, and this occurs where n = 9 (with four painted sides and two, adjacent, non-painted sides). The larger cube must have a dimension of nine.
The larger cube must have a dimension of nine.


Now that we have the dimensions of the larger cube, all we need to do is count the unit cubes that are painted on two sides.
We need to be careful so as not to double, or triple, count the number of two painted cubes. The double painted cubes occur on the edges (but not common corners).
Double Painted = [2×(n-1)] + [2×(n-1)] + [n-2]
Double Painted = 16 + 16 + 7 = 39
There will be 39 unit cubes painted on two sides.
A picture paints a thousand words (see what I did there?). Here is a net of the solution. The single painted cubes are colored red, the doubly painted cubes are colored green, and the triply painted cubes in the common corners are painted pink. I’ve labeled each double painted cube with a distinct number to disambiguate as they appear in two places on the net when un-folded.