# Enigmatic Code

Programming Enigma Puzzles

## Enigma 1456: Cutting edge

From New Scientist #2617, 18th August 2007

I started with a small rectangular block with one end a square, ABCD, and with a correspondingly labelled square at the other end, A*B*C*D*. I made two cuts through the block, one through the plane ACD* and the other through the plane A*C*D. This cut the block into four pieces, and I discarded the smallest three of those.

The volume of the remaining piece is a two-figure number of cubic centimetres. By coincidence, in that number each of the two digits was the length of one of the sides of the original rectangular block.

What, in cubic centimetres, is the volume of this remaining piece?

[enigma1456]

### One response to “Enigma 1456: Cutting edge”

1. Jim Randell 2 March 2013 at 11:32 am

Suppose the dimensions of the block are: AB = AD = BC = BD = A*B* = A*D* = B*C* = B*D* = a and AA* = BB* = CC* = DD* = b.

Then the volume of the complete block is v = a²b.

The volume of the pyramid removed by the cut ACD* is ⅓ × ½ a²b = v/6.

Similarly the volume of the pyramid removed by the cut A*C*D is v/6.

And the intersection of these two pyramids is a third pyramid DM1D*M2, where M1 is the centre point of face AA*D*D and M2 is the centre point of face CC*D*D.

It has a volume of ⅓ × (½ × ½ ab) × ½ a = v/24.

So the volume of the remaining piece of the block is v – 2 × v/6 + v/24 = (17/24) v.

The following Python program finds the dimensions on the block such that the dimensions form the digits of the volume of the remaining piece of the block. It runs in 39ms.

```# suppose the cube has square faces a x a, and the remaining dimension is b

# then each slice removes a volume of:
# 1/3 x (1/2 x a^2) x b = 4/24 x (a^2 b)

# and the overlapping volume of these removed pieces is:
# 1/3 x (1/4 x a x b) x (1/2 x a) = 1/24 (a^2 b)

# so the volume of the piece we're interested in is:
# 24/24 x a^2 x b - 2 x (4/24 x a^2 x b) + (1/24 x a^2 x b)
# = (24 - 8 + 1)/24 x a^2 x b
# = 17/24 x a^2 x b

from itertools import product
from enigma import irange, printf

# a and b are single digits
for (a, b) in product(irange(1, 9), repeat=2):
# the volume of the remaining piece
(v, r) = divmod(17 * a * a * b, 24)
# it should be a whole number
if r > 0: continue
# and the digits should be the dimensions of the cube
if sorted(divmod(v, 10)) != sorted((a, b)): continue
printf("v={v} [a={a} b={b}]")
```

Solution: The remaining piece has a volume of 34 cu cm.