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

Solution. Let the given consecutive natural numbers be denoted by $k, k+1, \ldots, k+15$. Note that if some number lies on the segment $[k ; k+15]$, then the sum of the distances from it to the given sixteen numbers does not exceed $8 \cdot 15=120$ (the sum of the distances to the two extreme numbers is exactly 15, the sum of the distances to $k+1$ and $k+14$ does not exceed 15, the sum of the distances to $k+2$ and $k+13$ also does not exceed 15, and so on). Therefore, the numbers $a$ and $a^{2}$ lie outside the segment $[k ; k+15]$. Then the sum of the distances from the number $a$ to each of the given consecutive numbers is expressed by the formula $|16 a-k-(k+1)-\ldots-(k+15)|=|16 a-16 k-120|$. Similarly, the sum of the distances from the number $a^{2}$ to each of the given numbers is $\left|16 a^{2}-16 k-120\right|$. We obtain the system of equations

$$
\left\{\begin{array}{l}
\left|16 a^{2}-16 k-120\right|=591 \\
|16 a-16 k-120|=636
\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+15]$. Then

$$
\left\{\begin{array} { l } 
{ 1 6 a ^ { 2 } - 1 6 k - 1 2 0 = 5 9 1 , } \\
{ 1 6 a - 1 6 k - 1 2 0 = 6 3 6 }
\end{array} \Leftrightarrow \left\{\begin{array}{l}
16 a-16 k-120=636 \\
16 a^{2}-16 a+45=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+15]$. Then

$$
\left\{\begin{array} { l } 
{ 1 6 k + 1 2 0 - 1 6 a ^ { 2 } = 5 9 1 , } \\
{ 1 6 k + 1 2 0 - 1 6 a = 6 3 6 }
\end{array} \Leftrightarrow \left\{\begin{array} { l } 
{ 1 6 k + 1 2 0 - 1 6 a = 6 3 6 , } \\
{ 1 6 a ^ { 2 } - 1 6 a - 4 5 = 0 }
\end{array} \Leftrightarrow \left\{\begin{array}{l}
k=a+32.25 \\
{\left[\begin{array}{l}
a=-1.25 \\
a=2.25
\end{array}\right.}
\end{array}\right.\right.\right.
$$

Since $k \in \mathbb{Z}$, only the case $a=-1.25$ fits (then $k=31$); in the case $a=2.25$, it turns out that $k=34.5$.

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

$$
\left\{\begin{array} { l } 
{ 1 6 a ^ { 2 } - 1 6 k - 1 2 0 = 5 9 1 , } \\
{ 1 6 k + 1 2 0 - 1 6 a = 6 3 6 }
\end{array} \Leftrightarrow \left\{\begin{array}{l}
16 k+120-16 a=636 \\
16 a^{2}-16 a-1227=0
\end{array}\right.\right.
$$

The quadratic equation is equivalent to the following: $2 a^{2}-2 a-\frac{1227}{8}=0 ; D=4+1227=1231$; $a=\frac{2 \pm \sqrt{1231}}{4}$. 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, it is possible only that $a=-1.25=-\frac{5}{4}$.