Some squares of a $n \times n$ table ($n>2$) are black, the rest are white. In every white square, we write the number of the black squares having at least one vertex with it. Find the max possible sum of these numbers.
What I did until now was just trying for small n and did not catch anything generalizable.
A general proof
Consider an inductive step of adding an extra row and column to an $(n-1)\times(n-1)$ board, for $n\ge 2$.
The image shows the three types of vertices we need to deal with, shown in the case $n=4$.
The vertices
In general, there will be two vertices of type A, one of type B and $2(n-2)$ of type C.
We shall award points to these vertices by the following method which is designed so that the sum of these points will be precisely the extra score created by adding the row and column.
Type A The score will be $0$ or $0.5$ depending upon whether the adjacent squares have the same colour or not.
Type B and Type C Award points to pairs of oppositely coloured squares as follows:
1 point if they are diagonally opposite;
1 point if they are both on an outside edge;
0.5 points if they share an edge and only one of the squares is on an outside edge.
Thus a maximum of $3.5$ points can be awarded to the type B vertex and a maximum of $3$ points to a type C vertex.
An upper bound on the additional score is therefore the integer part of $$2\times0.5+3.5+3\times2(n-2)=6n-7.5$$ i.e $6n-8$.
For a $1\times 1$ board the score is $0$ and so an upper bound for the $n\times n$ board is $$\sum_{i=2}^n (6i-8)=3n^2-5n+2.$$
This completes the proof since this score is attained by a striped board.
N.B The scores awarded to points differ from those used by Joriki because we are not counting points already awarded in the $(n-1)\times(n-1)$ board and, for type C, some adjacencies are not counted by any other vertex.