Consider a regular $2 n$-gon $P$ in the plane, where $n$ is a positive integer. We say that a point $S$ on one of the sides of $P$ can be seen from a point $E$ that is external to $P$, if the line segment $S E$ contains no other points that lie on the sides of $P$ except $S$. We want to color the sides of $P$ in 3 colors, such that every side is colored in exactly one color, and each color must be used at least once. Moreover, from every point in the plane external to $P$, at most 2 different colors on $P$ can be seen (ignore the vertices of $P$, we consider them colorless). Find the number of distinct such colorings of $P$ (two colorings are considered distinct if at least one side is colored differently).
Answer: For $n=2$, the answer is 36 ; for $n=3$, the answer is 30 and for $n \geq 4$, the answer is $6 n$.

Lemma 1. Given a regular $2 n$-gon in the plane and a sequence of $n$ consecutive sides $s_{1}, s_{2}, \ldots, s_{n}$ there is an external point $Q$ in the plane, such that the color of each $s_{i}$ can be seen from $Q$, for $i=1,2, \ldots, n$.

Proof. It is obvious that for a semi-circle $S$, there is a point $R$ in the plane far enough on the bisector of its diameter such that almost the entire semi-circle can be seen from $R$.

Now, it is clear that looking at the circumscribed circle around the $2 n$-gon, there is a semi-circle $S$ such that each $s_{i}$ either has both endpoints on it, or has an endpoint that's on the semi-circle, and is not on the semi-circle's end. So, take $Q$ to be a point in the plane from which almost all of $S$ can be seen, clearly, the color of each $s_{i}$ can be seen from $Q$.

Lemma 2. Given a regular $2 n$-gon in the plane, and a sequence of $n+1$ consecutive sides $s_{1}, s_{2}, \ldots, s_{n+1}$ there is no external point $Q$ in the plane, such that the color of each $s_{i}$ can be seen from $Q$, for $i=1,2, \ldots, n+1$.

Proof. Since $s_{1}$ and $s_{n+1}$ are parallel opposite sides of the $2 n$-gon, they cannot be seen at the same time from an external point.

For $n=2$, we have a square, so all we have to do is make sure each color is used. Two sides will be of the same color, and we have to choose which are these 2 sides, and then assign colors
according to this choice, so the answer is $\binom{4}{2} \cdot 3 \cdot 2=36$.

For $n=3$, we have a hexagon. Denote the sides as $a_{1}, a_{2}, \ldots, a_{6}$, in that order. There must be 2 consecutive sides of different colors, say $a_{1}$ is red, $a_{2}$ is blue. We must have a green side, and only $a_{4}$ and $a_{5}$ can be green. We have 3 possibilities:

1) $a_{4}$ is green, $a_{5}$ is not. So, $a_{3}$ must be blue and $a_{5}$ must be blue (by elimination) and $a_{6}$ must be blue, so we get a valid coloring.
2) Both $a_{4}$ and $a_{5}$ are green, thus $a_{6}$ must be red and $a_{5}$ must be blue, and we get the coloring rbbggr.
3) $a_{5}$ is green, $a_{4}$ is not. Then $a_{6}$ must be red. Subsequently, $a_{4}$ must be red (we assume it is not green). It remains that $a_{3}$ must be red, and the coloring is rbrrgr.

Thus, we have 2 kinds of configurations:

i) 2 opposite sides have 2 opposite colors and all other sides are of the third color. This can happen in 3.(3.2.1) $=18$ ways (first choosing the pair of opposite sides, then assigning colors), ii) 3 pairs of consecutive sides, each pair in one of the 3 colors. This can happen in $2.6=12$ ways (2 partitioning into pairs of consecutive sides, for each partitioning, 6 ways to assign the colors).

Thus, for $n=3$, the answer is $18+12=30$.

Finally, let's address the case $n \geq 4$. The important thing now is that any 4 consecutive sides can be seen from an external point, by Lemma 1.

Denote the sides as $a_{1}, a_{2}, \ldots, a_{2 n}$. Again, there must be 2 adjacent sides that are of different colors, say $a_{1}$ is blue and $a_{2}$ is red. We must have a green side, and by Lemma 1, that can only be $a_{n+1}$ or $a_{n+2}$. So, we have 2 cases:

Case 1: $a_{n+1}$ is green, so $a_{n}$ must be red (cannot be green due to Lemma 1 applied to $a_{1}, a_{2}, \ldots, a_{n}$, cannot be blue for the sake of $a_{2}, \ldots, a_{n+1}$. If $a_{n+2}$ is red, so are $a_{n+3}, \ldots, a_{2 n}$, and we get a valid coloring: $a_{1}$ is blue, $a_{n+1}$ is green, and all the others are red.

If $a_{n+2}$ is green:

a) $a_{n+3}$ cannot be green, because of $a_{2}, a_{1}, a_{2 n} \ldots, a_{n+3}$.
b) $a_{n+3}$ cannot be blue, because the 4 adjacent sides $a_{n}, \ldots, a_{n+3}$ can be seen (this is the case that makes the separate treatment of $n \geq 4$ necessary)
c) $a_{n+3}$ cannot be red, because of $a_{1}, a_{2 n}, \ldots, a_{n+2}$.

So, in the case that $a_{n+2}$ is also green, we cannot get a valid coloring.

Case 2: $a_{n+2}$ is green is treated the same way as Case 1.

This means that the only valid configuration for $n \geq 4$ is having 2 opposite sides colored in 2 different colors, and all other sides colored in the third color. This can be done in $n \cdot 3 \cdot 2=6 n$ ways.