A 30x30x30 cube is made by gluing together 303
=27000 unit cubes. A square pyramid
having each side of the base as 30 units and, height from base to the apex of the pyramid as 30 units is cut out of the cube by means of an infinitely thin laser-like cutting tool.
How many unit cubes will stay undamaged inside the pyramid?
: The apex of the pyramid is located perpendicularly above the center of the square base.
The base of the pyramid is as mentioned a square of side length 30.
One unit up, the horizontal cross-section has side length 29, etc., so that at the top the cross-sectional "side length" is zero.
At a side length of 29, the square cross section extends 14.5 units above, below and to each side of center. This prevents the outer square ring of cubic blocks on the bottom level from being undamaged and contained within the pyramid, so the first level has 28*28 blocks.
At the plane 2 units from the ground, the pyramid's cross-section is 28x28. This allows the second level of cubic blocks also to contain 28*28 blocks.
Overall then, the count of the set of undamaged blocks completely within the pyramid is 2*(28*28 + 26*26 + 24*24 + ... + 2*2 + 0*0). The last two 0x0's result from the top cap of the pyramid consisting of small pieces of four cubic blocks and the second layer from the top consisting of larger pieces of four cubic blocks, as the horizontal plane one unit from the top is only 1x1 and cuts through the centers of the top faces of the four blocks in the center of the second layer from the top.
This comes out to 8120. As a check, this comes in under the 9000 cubic-unit volume of the pyramid, with the missing volume being that of the partial blocks included within the pyramid.
FOR i = 0 TO 28 STEP 2
t = t + i * i
PRINT 2 * t
Posted by Charlie
on 2010-06-02 14:12:35