All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Cut Cube = Cone (Posted on 2005-03-17)
You make a 9x9x9 cube by gluing together 9³=729 unit cubes. You machine a cone (base diameter= height= 9 units) out of the cube. How many unit cubes will stay undamaged inside the cone?

 See The Solution Submitted by Old Original Oskar! No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 Computer Solution Comment 2 of 2 |

The following program tests the farthest point at the top face of each small cube.  As an extra it also tests the nearest point on the bottom face of each small cube in order to count how many cubes were completely removed.  Then, after subtracting out the two, it shows how many cubes were partially removed.

DEFDBL A-Z
CLS
smallMiss = 999
FOR x = -4 TO 4
FOR y = -4 TO 4
FOR z = 1 TO 9
mostR = 0
FOR x1 = x - .5 TO x + .5
FOR y1 = y - .5 TO y + .5
r = SQR(x1 * x1 + y1 * y1)
IF r > mostR THEN mostR = r
NEXT
NEXT
coneR = (9 - z) / 2
miss = ABS(coneR - mostR)
IF miss < smallMiss THEN smallMiss = miss
IF mostR <= coneR THEN ct = ct + 1
NEXT
NEXT
NEXT
PRINT ct, smallMiss, 1 / smallMiss

ct1 = ct

ct = 0
smallMiss = 999
FOR x = -4 TO 4
FOR y = -4 TO 4
FOR z = 0 TO 8
leastR = 9999
FOR x1 = x - .5 TO x + .5
FOR y1 = y - .5 TO y + .5
r = SQR(x1 * x1 + y1 * y1)
IF r < leastR THEN leastR = r
NEXT
NEXT
coneR = (9 - z) / 2
miss = ABS(coneR - leastR)
IF miss < smallMiss THEN smallMiss = miss
IF leastR >= coneR THEN ct = ct + 1
NEXT
NEXT
NEXT
PRINT ct, smallMiss, 1 / smallMiss

PRINT 9 * 9 * 9 - ct1 - ct

It finds

95 cubes were completely untouched
429 cubes were removed completely
205 cubes were partially removed

The smallMiss variable was shown (about 1/28) to make sure that no cube was counted on a particular side of the cone surface due to rounding errors.  The 1/28 value is large enough to show it is not a rounding error in the square root function, and in fact no cube vertex is exactly on the cone surface.

 Posted by Charlie on 2005-03-17 19:31:42

 Search: Search body:
Forums (1)