# Four-by-four square

Consider the sixteen cells in a $4\times4$ square. Two (distinct) cells are neighbors, if they share a horizontal or vertical edge; note that every cell has two or three or four neighbors. Now each of the sixteen cells contains an integer, so that for every cell the integers in the neighboring cells add up to the sum $120$.

(a) What are the possible values for the sum of the sixteen integers?

(b) Does there exist such a $4\times4$ square in which the sixteen integers are pairwise distinct?

• As it is stated, the values in the neighborhood of a cell excluding the cell itself need to sum to 120. Is that indeed the intention? – Johannes Jan 26 '15 at 9:54
• @Johannes: Yes, exactly: the values in the neighborhood of a cell excluding the cell itself need to sum to 120. – Gamow Jan 26 '15 at 9:56

Coloring the 16 cells like a checkerboard, it follows that the cells of one color can be represented as:

With $a+b=120$. This guarantees that the neighborhood of each grey cell sums to 120.

As multiple cells share the same value, it is not possible to have all cell values pairwise distinct.

The sum total for the 8 cells of given color equals $3a+3b=360$, so that all cells together add up to 720.

• It's worth noting that the two white cells in the centre can contain non-zero integers (one the negative of the other), although it doesn't affect the ultimate solution. – Volatility Jan 26 '15 at 11:08
• @Johannes - Volatility is right. Your current diagonal shows the values a,0,0,b. This can be changed to a+x,-x,x,b-x for any choice of x. – Alexis Jan 26 '15 at 11:31
• @Volatility - correct. The original problem stated all values to be non-negative. Have changed the picture to reflect the relaxation of this constraint. – Johannes Jan 26 '15 at 11:40

The solution to part (a):

The integers must sum to 720

Reason:

Let us number the cells like in a matrix. Consider the neighbours of the cells $(0, 0), (0, 1), (1, 3), (2, 3), (3, 1)$ and $(3, 0)$. The sets of neighbours for each of these cells are pairwise disjoint, and their union covers all the cells. The sum of the neighbouring cells for a particular cell is $120$, and there are 6 cells above, therefore the sum is $6 \times 120 = 720$.

The solution to part (b):

No.

Reason:

Consider cells $(0, 1)$ and $(1, 0)$. They have common neighbours $(0, 0)$ and $(1, 1)$. Cell $(0, 1)$ has a third neighbour $(0, 2)$, and cell $(1, 0)$ has a third neighbour $(2, 0)$. For the sums of the neighbours of each of the two cells to equal $120$ (and therefore equal each other), cells $(0, 2)$ and $(2, 0)$ must contain the same integer (as the other neighbours are common), so therefore there does not exist a $4 \times 4$ square such that the sixteen integers are pairwise distinct.