### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,114)
- misc (2)
- project euler (2)
- puzzle (29)
- site news (43)
- tantalizer (29)
- teaser (3)

### Site Stats

- 166,224 hits

Programming Enigma Puzzles

17 April 2015

Posted by on **From New Scientist #2396, 24th May 2003** [link]

Joe’s daughter likes puzzles just as much as her father and spends quite some time designing her own.

Last weekend, while just fiddling with some standard dice, she worked out that she could stack them, one on one, so that the total obtained from the numbers on one face of the stack was the same for all four faces when she used the following rule:

Take the number on one face of the first dice, add to it twice the number on the corresponding face on the second dice, three times the number on the third dice, and so on.

She made a stack and showed it to her father. After some thought and a few calculations, Joe told her that by adding a few more dice his total would be six times hers.

How many extra dice did Joe have in mind?

[enigma1240]

Advertisements

%d bloggers like this:

If we consider one face of the stack,

(a1, a2, …, an). Then the opposite face is(7 – a1, 7 – a2, …, 7 – an).These two faces must have the same sum,

S, (using the measure given in the problem):So the sum only depends on the number of layers in the stack:

and is only achievable for those

nwhenT(n)is even.This Python 3 program looks for possible numbers as a candidate solution, and then constructs an example stack. It runs in 54ms.

Solution:Joe had 5 extra dice in mind.The daughter stacked 3 dice, to give a face sum of 21.

Joe stacked 8 dice (an extra 5), to give a face sum of 126.

One example of such a stack is:

There are essentially 7 different ways that the daughter could build her stack of 3, and for each of these there are 278 essentially different ways Joe could complete it to give a stack of 8. (If we count reflections/rotations separately this count can by multiplied up considerably).

The next smallest pair that give a possible solution are when the daughter stacks 143 dice, with a face sum of 36036, and Joe stacks 351 dice (an extra 208), to give a face sum of 216216. But I don’t think such large towers of dice would be feasible.

Like the example solution given above for 3 and 8, if we can split (1, …, 143) in to two sets that each sum 5148, and (144, …, 351) in to two sets that each sum 25740, then we can easily construct a solution. In both cases the required sum can be achieved from consecutive subsets. The first set can be split into (3, …, 101) and its complement. The second can be split into (155, …, 274) and its complement. So certainly solutions exist.

In fact if we run the program looking for candidate solutions (without attempting to construct the corresponding towers we get the following values):

And all of these can be solved using the consecutive subsets approach, so perhaps the problem should have limited the number of dice available to some upper limit less than 143.

Or maybe the dice could be specified as 2 cm cubes!

This solution uses my Python library of number theory algorithms at http://ccgi.gladman.plus.com/wp/?page_id=1500 (the latest version will be needed as I have just updated it as a result of doing this enigma). It is massive overkill to solve what is a simple variant of Pell’s equation but it is there so it might as well be used.