4. Let $n>1$ be a natural number. An equilateral triangle with side length $n$ is divided by lines parallel to its sides into congruent equilateral smaller triangles with side length 1. The number of smaller triangles that have at least one side on the side of the original triangle is 1 less than the number of all other smaller triangles. Determine all such $n$.
First method:

For $n=2$

![](https://cdn.mathpix.com/cropped/2024_05_30_3cbbf7de75a41eab3027g-21.jpg?height=294&width=329&top_left_y=2212&top_left_x=378)

the number of small triangles with at least one side lying on the side of the original triangle is 3, and the number of all remaining small triangles is 1, which means the condition is not satisfied.

For $n>2$, let the small triangles at the vertices of the given triangle be black, the small triangles that share exactly one side with the boundary of the triangle (but are not at the vertex of the given triangle) be blue, the small triangles that share only a vertex with the boundary of the original triangle be red, and the small triangles inside the original triangle be white.
![](https://cdn.mathpix.com/cropped/2024_05_30_3cbbf7de75a41eab3027g-22.jpg?height=526&width=1106&top_left_y=676&top_left_x=383)

The given condition can now be rephrased as: "the total number of black and blue small triangles is 1 less than the total number of white and red small triangles."

We observe that the number of red and blue small triangles is the same (consider one red small triangle, then in the positive direction, a blue one sharing a side, and in the positive direction, a red one sharing a side with the blue one, and so on until we return to the initial red small triangle). This means that the number of black small triangles must be 1 less than the number of white small triangles. However, the number of black small triangles is always 3, so the number of white small triangles must be 4.

This is possible only for $n=5$.