1. A student wrote a program to recolor a pixel into one of 128 different colors. These colors he numbered with natural numbers from 1 to 128, and the primary colors received the following numbers: white color - number 1, red - 5, orange - 13, yellow - 19, green - 23, blue - 53, blue - 55, purple - 83, black - 128. If the initial color of the pixel has a number \( n \leq 17 \), then the student's program recolors it to the color with the number \( 3n - 2 \), and if the initial color of the pixel has a number \( n \geq 18 \), then the pixel is recolored to the color with the number \( |129 - 2n| \). Initially, the pixel was red. The student applied his program 2019 times sequentially. What color did the pixel end up with?
Solution. The final pixel color number is equal to $f^{[2019]}(5)$, where $f^{[k]}(n)=\underbrace{f(f(f(\ldots(f}_{k \text { times }}(n) \ldots)-k$ is the $k$-fold composition of the function $f(n)$, which is equal to $3 n-2$ for $n \leq 17$, and equal to $|129-2 n|$ for $n \geq 18$. Let's compute and write down the first few values: $f(5)=13, \quad f^{[2]}(5)=37, f^{[3]}(5)=55, \quad f^{[4]}(5)=19, f^{[5]}(5)=91, \quad f^{[6]}(5)=53, \quad f^{[7]}(5)=23$, $f^{[8]}(5)=83, f^{[9]}(5)=37=f^{[2]}(5)$. We have obtained a cycle of length 7 operations. Therefore, for any natural value of $k$ and any $r=0,1, \ldots, 6$, we have $f^{[2+7 k+r]}(5)=f^{[r]}(37)$. Since $2019=2+288 \cdot 7+1$, then $r=1$, and $f^{[2019]}(5)=f^{[1]}(37)=55$. The pixel will be blue.

Answer: blue.