### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,183)
- misc (2)
- project euler (2)
- puzzle (46)
- site news (46)
- tantalizer (49)
- teaser (3)

### Site Stats

- 184,820 hits

Advertisements

Programming Enigma Puzzles

25 July 2014

Posted by on **From New Scientist #1355, 28th April 1983** [link]

A double number slab is just two rows of squares in a rectangle, with the correct number in each square. The numbers in the top row are just 1, 2, 3, …,

n. In each bottom row square is written the number of times the number above it occurs in the completed slab.So, for instance, if

n=5, you fill in the top row as shown, and in the bottom row you replaceAby the number of 1’s,Bby the number of 2’s, …,Eby the number of 5’s in the whole slab.Given that

nis at least 4, can you say:(a) for what value of

nis it impossible to complete the slab properly?

(b) for what value ofnis each second-row number less than or equal to every number to the left of it?

[enigma209]

Advertisements

%d bloggers like this:

This Python program runs in 47ms.

Solution:(a) The slab cannot be completed forn=6; (b) Forn=7 the second row is a descending sequence.In general for

n> 6 there is a solution with the bottom row of the form:with (

n– 7) 1’s in the middle.As can be seen all but 4 of the numbers in the bottom row are 1, hence there are

n– 3 1’s overall (as required).There are two 2’s in the bottom row, hence 3 2’s overall.

There is one 3 in the bottom row, hence 2 3’s overall.

Whatever

n– 3 is there is only one of it in the bottom row, hence 2 occurrences overall.The remaining numbers don’t appear in the bottom row, so only appear once in the overall grid.

In case it’s of interest, I found no slabs for n < 4, two for n = 4 (2, 3, 2, 1 and 3, 1, 3, 1), and one for n = 5 (3, 2, 3, 1, 1).