# Find the missing numbers in this constrained matrix/grid

The numbers 1 to 16 inclusive are arranged in this 4x4 matrix, such that no two numbers that are adjacent (horizontally, vertically or diagonally) that are consecutive, i.e. they must have a difference of at least 2.

\begin{bmatrix}11&?&?&?\\?&?&14&?\\?&6&?&?\\?&?&?&8\end{bmatrix}

What are the missing numbers?

• Sorry there are many solutions to this. The program that I wrote to analyse solutions has a bug in it! Jul 25, 2017 at 13:28
• Has a correct answer been given? If so, please don't forget to $\color{green}{\checkmark \small\text{Accept}}$ it :)
– Rubio
Aug 7, 2017 at 23:03

I feel like this seems too simple so I've probably missed something but I have one solution here

| 11 09 07 04 |
| 16 01 14 12 |
| 10 06 03 05 |
| 02 15 13 08 |

My method is simple:

Throw numbers in at random and swap one in the wrong place with another that wont cause another problem!

• Sorry I forgot to mention the diagonal constraint, I have added this now. Therefore this is an invalid solution as several pairs of numbers diagonally are consecutive: (08 09), (11 12), (14 15) Jul 25, 2017 at 10:13
• Ah but you didn't say diagonally ;) Jul 25, 2017 at 10:14
• Apologies I have edited it now Jul 25, 2017 at 10:16
• Think I fixed it Jul 25, 2017 at 10:21
• Well done. I thought there was only one solution but yours is correct also :). Jul 25, 2017 at 12:23

There are so many possible answers if i understand the question correctly...

My example solution:

11 09 12 05
13 16 14 07
01 06 04 02
03 10 15 08

How did i figure this out?

Tried random numbers and it worked to my surprise :)

EDIT: Changed the numbers to match the new requirements
EDIT2: Added 'How did i figure this out?'

• Sorry I forgot to mention the diagonal constraint, I have added this now. Therefore this is an invalid solution as (05 06), and (15 16) are adjacent Jul 25, 2017 at 10:15

Like so many others before me, i have another answer, and i am sure there are more.

|11 03 10 05 |
|01 16 14 07 |
|13 06 04 12 |
|09 15 02 08 |

How i got there

I started at each corner and rotated each consecutive number to the alternate corner and one to the number's right. By placing them as far across, i assured there was no intersection against the rules

a few more

|11 03 05 10 |
|01 16 14 07 |
|13 06 04 12 |
|09 15 02 08 |

|11 03 05 10 |
|01 16 14 07 |
|13 06 04 12 |
|15 09 02 08 |

|11 03 05 10 |
|01 16 14 07 |
|13 06 04 02 |
|15 09 12 08 |