6. Let's call the distance between numbers the absolute value of their difference. It is known that the sum of the distances from twenty-seven consecutive natural numbers to some number $a$ is 1926, and the sum of the distances from these same twenty-seven numbers to the number $a^{2}$ is 1932. Find all possible values of $a$.
Answer: $a=\frac{2}{3}$.

Solution. Let the given consecutive natural numbers be denoted by $k, k+1, \ldots, k+26$. Notice that if some number lies on the segment $[k ; k+26]$, then the sum of the distances from it to the given twenty-seven numbers does not exceed $\frac{27}{2} \cdot 26=351$ (the sum of the distances to the two extreme numbers is exactly 26, the sum of the distances to $k+1$ and $k+25$ does not exceed 26, the sum of the distances to $k+2$ and $k+24$ also does not exceed 26, and so on; the distance to $k+13$ does not exceed half the length of the segment, i.e., 13). Therefore, the numbers $a$ and $a^{2}$ lie outside the segment $[k ; k+26]$. Then the sum of the distances from the number $a$ to each of the given consecutive numbers is expressed by the formula $|27 a-k-(k+1)-\ldots-(k+26)|=|27 a-27 k-351|$. Similarly, the sum of the distances from the number $a^{2}$ to each of the given numbers is equal to $\left|27 a^{2}-27 k-351\right|$. We obtain the system of equations

$$
\left\{\begin{array}{l}
\left|27 a^{2}-27 k-351\right|=1932 \\
|27 a-27 k-351|=1926
\end{array}\right.
$$

Consider four cases of opening the modulus.

1) Both numbers $a$ and $a^{2}$ lie to the right of the segment $[k ; k+26]$. Then

$$
\left\{\begin{array} { l } 
{ 2 7 a ^ { 2 } - 2 7 k - 3 5 1 = 1 9 3 2 , } \\
{ 2 7 a - 2 7 k - 3 5 1 = 1 9 2 6 }
\end{array} \Leftrightarrow \left\{\begin{array}{l}
27 a-27 k-351=1926 \\
27 a^{2}-27 a-6=0
\end{array}\right.\right.
$$

The quadratic equation is equivalent to the following: $3 a^{2}-3 a-\frac{2}{3}=0 ; D=9+8=17 ; a=$ $\frac{3 \pm \sqrt{17}}{6}$. Then from the first equation of the system, it follows that $k$ is an irrational number, which does not satisfy the condition.

(c) MIPT, 2018

2) Both numbers $a$ and $a^{2}$ lie to the left of the segment $[k ; k+26]$. Then

$$
\left\{\begin{array} { l } 
{ 2 7 k + 3 5 1 - 2 7 a ^ { 2 } = 1 9 3 2 , } \\
{ 2 7 k + 3 5 1 - 2 7 a = 1 9 2 6 }
\end{array} \Leftrightarrow \left\{\begin{array} { l } 
{ 2 7 k + 3 5 1 - 2 7 a = 1 9 2 6 , } \\
{ 9 a ^ { 2 } - 9 a + 2 = 0 . }
\end{array} \Leftrightarrow \left\{\begin{array}{l}
k=a+58 \frac{1}{3}, \\
{\left[\begin{array}{l}
a=\frac{2}{3} \\
a=\frac{1}{3}
\end{array}\right.}
\end{array}\right.\right.\right.
$$

Since $k \in \mathbb{Z}$, only the case $a=\frac{2}{3}$ fits (then $k=59$); in the case $a=\frac{1}{3}$, it turns out that $k=58 \frac{2}{3}$.

3) The number $a$ lies to the left, and $a^{2}$ - to the right of the segment $[k ; k+26]$. Then

$$
\left\{\begin{array} { l } 
{ 2 7 a ^ { 2 } - 2 7 k - 3 5 1 = 1 9 3 2 , } \\
{ 2 7 k + 3 5 1 - 2 7 a = 1 9 2 6 }
\end{array} \Leftrightarrow \left\{\begin{array}{l}
27 k+351-27 a=1926 \\
9 a^{2}-9 a-1286=0
\end{array}\right.\right.
$$

The quadratic equation is equivalent to the following: $3 a^{2}-3 a-\frac{1286}{3}=0 ; D=9+4 \cdot 1286=5153$; $a=\frac{3 \pm \sqrt{5153}}{6}$. Then from the first equation of the system, it follows that $k$ is an irrational number, which does not satisfy the condition.

4) The number $a$ lies to the right, and $a^{2}$ - to the left of the segment $[k ; k+15]$. Obviously, this case does not fit, because if $a>a^{2}$, then both numbers $a$ and $a^{2}$ lie on the segment $[0 ; 1]$, but then there cannot be any integer between them.

Thus, only $a=\frac{2}{3}$ is possible.