√(3² + 4² + 12²) prints 13, and the sum under the root is 169. There are two Pythagorean steps hiding in that: the floor's diagonal is √(9 + 16) = 5, the 3-4-5 triangle lying flat, and the diagonal from a floor corner to the opposite ceiling corner is then √(5² + 12²) = 13 — the 5-12-13 triple standing up. Nesting one triple inside another is the general recipe for a box whose diagonal is a whole number.
A cube gets no such luck. Its diagonal is √(1 + 1 + 1) = √3 = 1.7320508075689, irrational, because no two triples will stack with equal sides. The same √3 is what makes the space diagonal formula so unforgiving: the three squares add, and unless they add to a square there is no tidy answer — which is why the 13 in this problem is a coincidence of arithmetic, not a property of boxes.
Answer
13
How to read it
The space diagonal of a 3 × 4 × 12 box; 3² + 4² + 12² = 169 = 13². The unit cube's diagonal, by contrast, is √3.
Source
The space diagonal of a cuboid, d = √(a² + b² + c²); (3, 4, 12, 13) is the standard brick example, nesting two primitive triples
Work it in the calculator
These links open the right calculator with this problem's numbers already typed in. The line above is what the screen should show — check it yourself.