Lambdia

A Thousand Cubes, One Shell, and 488

Strip the outer shell off a ten-by-ten-by-ten block of unit cubes and count what falls. The reflex answer, 271, is arithmetic done correctly on the wrong picture: a shell leaves from both opposing faces, so every axis loses two units and not one. Two independent counts land on 488, and the general shell turns out to grow like a surface rather than a volume.

Glue a thousand unit cubes into a block, ten along every edge. Now strip off the entire outer shell, meaning every unit cube that touches a face of the block, and let the loose cubes fall. How many hit the floor?

The problem takes about four seconds to state and it is asked on trading desks precisely because the arithmetic is trivial. What is being tested is whether you can hold a three-dimensional picture in your head for long enough to notice that a shell has two sides. Most candidates do the arithmetic perfectly and still get the wrong number.

Where the instant answer comes from

The reflex is to reason that removing one layer takes the side length from ten down to nine, so the shell must be the difference between the two blocks:

10393=1000729=27110^3 - 9^3 = 1000 - 729 = 271
(1)

This is arithmetic done properly on the wrong picture. Nothing about the calculation is sloppy, which is exactly why the mistake survives a nervous candidate re-checking his work. He checks the subtraction, not the model.

A shell has two sides

Take one axis and follow it. The shell contains the cubes at position 11 along that axis, and it also contains the cubes at position 1010. Both ends. So the surviving range along that axis is 2,3,,92, 3, \dots, 9, which is eight values, not nine. The same argument runs independently on all three axes, and none of the three is privileged, so each one loses two.

Fig. 1 — One cross-section is enough to see it. The shell leaves from the left face and the right face, so the side drops by two.
The core

A unit cube belongs to the shell when at least one of its three coordinates equals 11 or nn, and to the core otherwise. The core of an nn-cube is therefore an (n2)(n-2)-cube.

That characterisation is worth stating carefully, because it is the only step where the problem can be misread. A cube whose coordinates all lie in 2,,n12, \dots, n-1 spans [i1,i][i-1, i] with i11i - 1 \ge 1 and in1i \le n-1, so its nearest point to either bounding plane is a full unit away. It touches nothing. Conversely every cube with an extreme coordinate contains an entire unit square lying in the boundary. There is no ambiguous middle case, and in particular the edge and corner cubes, which touch two or three faces at once, are counted exactly once each.

The count

The core is an 8×8×88 \times 8 \times 8 block, so what stays standing is 83=5128^3 = 512 cubes, and the shell is everything else:

10383=1000512=48810^3 - 8^3 = 1000 - 512 = 488
(2)

The same number counted a completely different way

A count you obtained one way is a count you should distrust. Here is a second route that shares no step with the first: instead of subtracting the core, build the shell out of its pieces. A cube in the shell has one extreme coordinate if it sits in the middle of a face, two if it sits along an edge, and three if it is a corner.

6(n2)2faces  +  12(n2)edges  +  8corners\underbrace{6(n-2)^2}_{\text{faces}} \;+\; \underbrace{12(n-2)}_{\text{edges}} \;+\; \underbrace{8}_{\text{corners}}
(3)

At n=10n = 10, so with n2=8n - 2 = 8, that is 664+128+8=384+96+86 \cdot 64 + 12 \cdot 8 + 8 = 384 + 96 + 8.

Fig. 2 — Faces, edges and corners, counted separately and summed. The 488 does not come from the same place as in equation (2).

It lands on 488 again. Two independent derivations agreeing is the kind of thing worth saying out loud in an interview, because it demonstrates the habit the desk is hiring for.

The general shell, and where it stops working

Expanding either expression gives the same polynomial, which is the cleanest statement of the result:

n3(n2)3=6n212n+8n^3 - (n-2)^3 = 6n^2 - 12n + 8
(4)

Notice that this grows like n2n^2, not like n3n^3. A shell is a surface, and surfaces scale as the square. For a large block almost every cube is interior, which is the same reason a whale keeps warm more easily than a mouse.

Equation (4) is valid for every n2n \ge 2, and it fails at n=1n = 1. A single cube is its own shell, so the true count is 11, while the formula returns 612+8=26 - 12 + 8 = 2. The defect is not in the algebra but in the model: (n2)3=(1)3=1(n-2)^3 = (-1)^3 = -1 quietly counts a negative interior. At n=2n = 2 everything is fine, the core is empty and the formula returns 8=238 = 2^3, correctly removing all eight cubes.

Why 271 is seductive

The wrong answer is not noise. Count the cubes touching at least one of three mutually adjacent faces, say the three meeting at one corner, and you get exactly 271. So 271 is the correct answer to a genuine question, just not to this one. That is what makes it stick: the candidate has not miscalculated, he has silently answered a neighbouring problem.

Working out which problem you actually answered is a more useful post-mortem than checking the arithmetic again, and it generalises. Erosion of a discrete solid removes one layer per face, so a box of dimensions a×b×ca \times b \times c keeps a core of (a2)(b2)(c2)(a-2)(b-2)(c-2), and it disappears entirely as soon as any one of the three dimensions drops to two.

Sources and further reading

Every number in this article was checked twice before publication: symbolically, and by walking all one thousand cube positions and counting the ones that touch a face.

Comments · 0

Be the first to comment.