4. An $n \times n$ square is divided into unit squares. One needs to place a number of isosceles right triangles with hypotenuse 2, with vertices at grid points, in such a way that every side of every unit square belongs to exactly one triangle (i.e. lies inside it or on its boundary). Determine all numbers $n$ for which this is possible.

(Dušan Djukić)
4. There are $2 n(n+1)$ unit segments on the grid, and each triangle covers three, so we must have $3 \mid 2 n(n+1)$, i.e. $n \equiv 0$ or $n \equiv 2(\bmod 3)$. Moreover, the segments on the boundary of the big square have to be covered by hypotenuses, so we must also have $2 \mid n$. Therefore, $n \equiv 0$ or $n \equiv 2(\bmod 6)$.

The left image shows desired arrangements of triangles for $n=2$ and $n=6$, whereas the right image shows that every arrangement of triangles on an $n \times n$ squares can be extended to $(n+6) \times(n+$ 6). A simple induction shows that a de-

![](https://cdn.mathpix.com/cropped/2024_06_04_31a83bcaa45a5783e6aeg-15.jpg?height=477&width=737&top_left_y=1525&top_left_x=895)
sired arrangement exists whenever $n=6 k$ or $n=6 k-4$ for some $k \in \mathbb{N}$.