## Task A-1.4.

Determine all pairs of non-negative integers $(k, m)$ for which

$$
3 m^{3}-m+21=3^{3 k+1}-2 \cdot 3^{2 k+2}+3^{k+3}+3^{k+2}
$$
## Solution.

All expressions on both sides of the initial equality except $m$ are divisible by 3, so $m$ must also be divisible by 3. Therefore, there exists a natural number $n$ such that $m=3n$.

Now, let's express the initial equality using $n$ and $k$:

$$
(3n)^{3} - n + 7 = 3^{3k} - 2 \cdot 3^{2k+1} + 3^{k+2} + 3^{k+1}
$$

Introduce the substitution $a=3^{k}$. Then the expression on the right side of the last equality can be written as follows:

$$
\begin{aligned}
3^{3k} - 2 \cdot 3^{2k+1} + 3^{k+2} + 3^{k+1} & = a^{3} - 6a^{2} + 9a + 3a \\
& = a^{3} - 3 \cdot 2a^{2} + 3 \cdot 4a - 8 + 8 \\
& = (a-2)^{3} + 8
\end{aligned}
$$

Thus, the equation can be written as

$$
(3n)^{3} - n - 1 = (a-2)^{3}
$$

In the case when $n=0$, the equation becomes $(a-2)^{3} = -1$, whose only solution is $a=1$, from which $k=0$. This gives us one solution: $(k, m) = (0, 0)$.

Next, assume that $n \geqslant 1$. The expression

$$
(3n)^{3} - n - 1
$$

must be equal to a perfect cube, and it is clearly less than $(3n)^{3}$. Therefore,

$$
(3n)^{3} - n - 1 \leqslant (3n-1)^{3}
$$

since there is no other perfect cube of a natural number between the two consecutive cubes $(3n-1)^{3}$ and $(3n)^{3}$. From the obtained inequality, we get

$$
\begin{aligned}
(3n)^{3} - n - 1 & \leqslant (3n-1)^{3} \\
(3n)^{3} - n - 1 & \leqslant (3n)^{3} - 27n^{2} + 9n - 1 \\
27n^{2} - 10n & \leqslant 0 \\
27n - 10 & \leqslant 0
\end{aligned}
$$

which is not satisfied by any natural number $n$. Therefore, we conclude that the equation has no other solutions.

The only solution is $(k, m) = (0, 0)$.