### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,158)
- misc (2)
- project euler (2)
- puzzle (40)
- site news (44)
- tantalizer (42)
- teaser (3)

### Site Stats

- 177,959 hits

Advertisements

Programming Enigma Puzzles

21 April 2017

Posted by on **From New Scientist #1035, 20th January 1977** [link]

Someone gave my small son a bag of 1in cubes for Christmas and he was soon busy stacking them. First he built a rectangular wall one brick thick. Then he used the rest of the bricks to build another rectangular block, using 140 bricks more than the other. Then he got bored.

But I didn’t, as I spotted an intriguing fact. The sum of the lengths of the twelve edges on each construction was the same. So were the total surface areas of the two constructions (including the faces standing on the carpet). All the six dimensions involved were different.

How many bricks had he been given?

[tantalizer484]

Advertisements

%d bloggers like this:

Suppose the first block constructed has dimensions

(a, b, 1)and the second block has dimensions(x, y, z), then from the information given we have the following equations:[1] “The second block uses 140 bricks more than the first”

[2] “The sum of the lengths of the edges was the same for both blocks”

[3] “The total surface area of the two blocks is the same”

By expanding

(x – 1)(y – 1)(z – 1)we get:And we can substitute the bracketed expressions on the RHS with equations [1], [2], [3] to get:

which simplifies to give:

So we can consider factors of 140, to find

x, y, z, and then find corresponding values fora, b.The only solution is

(x, y, z) = (15, 6, 3)and(a, b, c) = (13, 10, 1).So the first block consists of 130 bricks, and the second of 270 bricks, giving 400 bricks in total, which will fit nicely into a 20″×20″ tray.

This Python 3 program finds the solution in 50ms.

Solution:There were 400 bricks in total.Note that the

divisor_tuples(n, k)function generates tuples ofdifferentdivisors, to make it a more general analogue ofdivisor_pairs(n)the tests need to be modified to return tuples containing repeated divisors.