5. For which $n$ can a square grid $n \times n$ be divided into one $3 \times 3$ square and some number of strips of seven cells, such that the square is adjacent to a side of the board?
Answer: for all $n$ that give a remainder of 3 when divided by 7.

Solution. If an $n \times n$ board can be cut into one $3 \times 3$ square and some number of strips of seven cells, then $n^{2}=3^{2}+7 m$, from which it follows that $n$ gives a remainder of 3 or 4 when divided by 7. Suppose $n=7 k+4$ and the board can be cut in the required manner. Rotate it so that the square adjoins the top side of the board. Write ones in the cells of the top row, twos in the cells of the next row, and so on. Note that the sum of the numbers in seven consecutive rows is divisible by 7, since

$$
n i+n(i+1)+n(i+2)+n(i+3)+n(i+4)+n(i+5)+n(i+6)=7 n(i+3) \vdots 7
$$

Therefore, the remainder when the sum of all the numbers written is divided by 7 is

$$
(n+2 n+3 n+4 n) \bmod 7=10(7 k+4) \bmod 7=5
$$

On the other hand, in each strip the sum of the numbers is divisible by seven, and in the square the sum of the numbers is $3+6+9=18$. Thus, the remainder when the sum of all the numbers written is divided by 7 is $18 \bmod 7=4$, and we have a contradiction.

If $n=7 k+3$, then we can cut out a corner $3 \times 3$ square, cut the top strip $3 \times 7 k$ into horizontal strips of seven cells, and cut the rectangle $7 k \times(7 k+3)$ into vertical strips of seven cells.