# 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.

## Puzzle

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?Advertisement:

## Solution

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.

- One face painted.
- Two, opposite, faces painted.
- Two, adjacent, faces painted.
- Three faces painted (that don’t meet in a corner).
- Three faces painted (that meet in a corner).
- Four faces painted (with two opposite sides clean).
- Four faces painted (with two adjacent sides clean).
- Five painted faces.
- 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.#1 | #2 | #3 | #4 | #5 | #6 | #7 | #8 | #9 | ||
---|---|---|---|---|---|---|---|---|---|---|

n=1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |

n=2 | 4 | 8 | 4 | 4 | 3 | 0 | 2 | 0 | 0 | |

n=3 | 9 | 18 | 12 | 15 | 12 | 12 | 12 | 9 | 6 | |

n=4 | 16 | 32 | 24 | 32 | 27 | 32 | 30 | 28 | 24 | |

n=5 | 25 | 50 | 40 | 55 | 48 | 60 | 56 | 57 | 54 | |

n=6 | 36 | 72 | 60 | 84 | 75 | 96 | 90 | 96 | 96 | |

n=7 | 49 | 98 | 84 | 119 | 108 | 140 | 132 | 145 | 150 | |

n=8 | 64 | 128 | 112 | 160 | 147 | 192 | 182 | 204 | 216 | |

n=9 | 81 | 162 | 144 | 207 | 192 | 252 | 240 | 273 | 294 | |

n=10 | 100 | 200 | 180 | 260 | 243 | 320 | 306 | 352 | 384 | |

n=11 | 121 | 242 | 220 | 319 | 300 | 396 | 380 | 441 | 486 | |

n=12 | 144 | 288 | 264 | 384 | 363 | 480 | 462 | 540 | 600 | |

n=13 | 169 | 338 | 312 | 455 | 432 | 572 | 552 | 649 | 726 | |

n=14 | 196 | 392 | 364 | 532 | 507 | 672 | 650 | 768 | 864 | |

n=15 | 225 | 450 | 420 | 615 | 588 | 780 | 756 | 897 | 1,014 | |

n=16 | 256 | 512 | 480 | 704 | 675 | 896 | 870 | 1,036 | 1,176 |

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.

## Calculating

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

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.