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-five consecutive natural numbers to some number $a$ is 1270, and the sum of the distances from these same twenty-five numbers to the number $a^2$ is 1234. Find all possible values of $a$.
Answer: $a=-\frac{4}{5}$.

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

$$
\left\{\begin{array}{l}
\left|25 a^{2}-25 k-300\right|=1234 \\
|25 a-25 k-300|=1270
\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+24]$. Then

$$
\left\{\begin{array} { l } 
{ 2 5 a ^ { 2 } - 2 5 k - 3 0 0 = 1 2 3 4 , } \\
{ 2 5 a - 2 5 k - 3 0 0 = 1 2 7 0 }
\end{array} \Leftrightarrow \left\{\begin{array}{l}
25 a-25 k-300=1270 \\
25 a^{2}-25 a+36=0
\end{array}\right.\right.
$$

The discriminant of the quadratic equation is negative, so there are no solutions.

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

$$
\left\{\begin{array} { l } 
{ 2 5 k + 3 0 0 - 2 5 a ^ { 2 } = 1 2 3 4 , } \\
{ 2 5 k + 3 0 0 - 2 5 a = 1 2 7 0 }
\end{array} \Leftrightarrow \left\{\begin{array} { l } 
{ 2 5 k + 3 0 0 - 2 5 a = 1 2 7 0 , } \\
{ 2 5 a ^ { 2 } - 2 5 a - 3 6 = 0 }
\end{array} \Leftrightarrow \left\{\begin{array}{l}
k=a+38.8 \\
{\left[\begin{array}{l}
a=-0.8 \\
a=1.8
\end{array}\right.}
\end{array}\right.\right.\right.
$$

Since $k \in \mathbb{Z}$, only the case $a=-0.8$ (then $k=38$) fits; in the case $a=1.8$, it turns out that $k=40.6$.

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

$$
\left\{\begin{array} { l } 
{ 2 5 a ^ { 2 } - 2 5 k - 3 0 0 = 1 2 3 4 , } \\
{ 2 5 k + 3 0 0 - 2 5 a = 1 2 7 0 }
\end{array} \Leftrightarrow \left\{\begin{array}{l}
25 k+300-25 a=1270 \\
25 a^{2}-25 a-2504=0
\end{array}\right.\right.
$$

The quadratic equation is equivalent to the following: $5 a^{2}-5 a-\frac{2504}{5}=0 ; D=25+4 \cdot 2504=10041$; $a=\frac{5 \pm \sqrt{10041}}{10}$. 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+24]$. 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, it is possible only that $a=-0.8=-\frac{4}{5}$.