4. A square $n \times n$ is divided into unit squares. It is necessary to place a certain number of isosceles right triangles with hypotenuse 2, with vertices at the vertices of the unit squares, in such a way that each side of each unit square belongs to exactly one triangle (i.e., lies in the interior or on the boundary). Determine all values of $n$ for which this is possible.

(Dushan Dukic)
4. There are $2 n(n+1)$ unit segments, and each triangle covers three, so it must be $3 \mid 2 n(n+1)$, i.e., $n \equiv 0$ or $n \equiv 2(\bmod 3)$. Also, the segments on the edge of the large square can only be covered by hypotenuses, so it must be $2 \mid n$. Therefore, $n \equiv 0$ or $n \equiv 2(\bmod 6)$. On the left, the corresponding placements of triangles for $n=2$ and $n=6$ are shown, while on the right, it is shown that whenever such a placement is possible for an $n \times n$ square, it is also possible for a $(n+6) \times(n+6)$ square. By simple induction, it follows that it is possible
![](https://cdn.mathpix.com/cropped/2024_06_04_0f66d532dd05e117e1c0g-4.jpg?height=486&width=762&top_left_y=1142&top_left_x=1044)
whenever $n=6 k$ or $n=6 k-4$ for some $k \in \mathbb{N}$.