5x5 Digit Matrix Puzzle

422 Views Asked by At

Is it possible to construct a 5x5 matrix of decimal digits, such that each of the numbers 0-99 are present as individual or adjacent digits. Adjacent can mean horizontal, vertical or diagonal and reversed in all three cases. For example, the matrix below contains 18 as the top left digits are 1 and 8, and 60 is diagonal at the bottom left.

\begin{array}{ccc} 1&8&7&9&4\\ 5&1&8&3&5\\ 3&0&6&2&5\\ 9&9&2&6&7\\ 3&1&4&4&0 \end{array}

The above matrix isn't a solution as 33,48,77 and 84 are missing. I would be interested to see a successful solution, or a proof that none exists.

1

There are 1 best solutions below

11
On

I don't know if it is possible, but it is very restrictive.

There are $72$ adjacent pairs of digits in the grid ($20$ horizontal, $20$ vertical, $16$ in each diagonal direction).

We want every two-digit number to occur. That means that we will have $10*9/2=45$ pairs with distinct digits, plus a further $9$ pairs with identical digits (we're excluding $00$). So our numbers use up $45+9=54$ adjacent pairs in the grid.

Consider any adjacent pair of identical digits. If there is a cell adjacent to both, then you waste one of the grids pairs because you will have a duplicate 2-digit number pairing. Wherever you place an identical digit pair, there will always be at least two neighbouring cells adjacent to both digits. If you place them horizontally or vertically and not at the outside edge of the grid, you even get four. In any case, every identical pair wastes two of the grid's pairings, so $9*2=18$ pairings get wasted in this manner.

Since $54+18=72$, you cannot waste any further grid pairings. In particular, you cannot put identical digits horizontally or vertically adjacent, unless they are both on the edge of the grid. In your example, the two horizontally adjacent $9$s show that it cannot be a solution.

Edit:
@TodorMarkov pointed out in the comments that it is possible to arrange two identical pairs so they diagonally cross each other. This uses up $6$ grid pairings, but contains three of the two-digit numbers. So this arrangement wastes only $3$ grid pairings on duplicates instead of the $4$ that the two identical pairs would otherwise waste.