21. (Problem from the 54th Belarusian Mathematical Olympiad) Let the positive integer $A=\overline{a_{n} a_{n-1} \cdots a_{1} a_{0}}, a_{n}, a_{n-1}, \cdots$, $a_{0}$ are all non-zero and not all equal ($n$ is a positive integer). The numbers
$$
\begin{array}{l}
A_{1}=\overline{a_{n-1} \cdots a_{1} a_{0} a_{n}}, \\
A_{2}=\overline{a_{n-2} \cdots a_{1} a_{0} a_{n} a_{n-1}}, \\
\cdots \cdots \\
A_{k}=\overline{a_{n-k} a_{n-k-1} \cdots a_{0} a_{n} \cdots a_{n-k+1}}, \\
\cdots \cdots \\
A_{n}=\overline{a_{0} a_{n} \cdots a_{1}}
\end{array}
$$

are obtained by cyclic permutations of $A$. Find $A$ such that any $A_{k} (k=1,2, \cdots, n)$ is divisible by $A$.
21. $A=\underbrace{142857} \underbrace{142857} \cdots \underbrace{142857}, k \in \mathbf{N}_{+}$.

Let $B=\overline{a_{n-1} \cdots a_{1} a_{0}}$, then
$A=a_{n} 10^{n}+B, A_{1}=10 B+a_{n}, B10^{n}-1 .
$

Therefore, $B \geqslant 10^{n}$, which is a contradiction.
Thus, $110^{n}$, which is a contradiction.
Similarly, if $m=4$, then $B=a_{n} \cdot \frac{4 \times 10^{n}-1}{6}$, hence, $2 \mid a_{n}$. Therefore,
$B \geqslant \frac{4 \times 10^{n}-1}{3}>10^{n}$, which is a contradiction.
Thus, $m$ can only have one solution $m=3$.
By $B=a_{n} \cdot \frac{3 \times 10^{n}-1}{7}<10^{n}$, we solve to get $a_{n} \leqslant 2$.
If $a_{n}=1$, then $B=\frac{3 \times 10^{n}-1}{7}$, so
$A=\frac{1}{7}\left(10^{n+1}-1\right)$;
If $a_{n}=2$, then $B=2 \times \frac{3 \times 10^{n}-1}{7}$, so
$A=\frac{2}{7}\left(10^{n+1}-1\right)$.
Since $A$ is a positive integer, we have $7 \mid\left(10^{n+1}-1\right)$.
It is easy to see that $7 \mid\left(10^{m}-1\right)$ if and only if $6 \mid m$.
Thus, $n+1=6 k, k \in \mathbf{N}_{+}$. Therefore,

Since $A_{4}=\overline{1 \cdots}<\overline{2 \cdots}=A$, i.e., $A_{4}$ cannot be divided by $A$, the second case is impossible.
On the other hand, the first case is the solution, because it is easy to prove that 142857 satisfies the condition:
$428571=3 \times 142857,285714=2 \times 142857,857142=6 \times 142857$,
$571428=4 \times 142857,714285=5 \times 142857$.
Thus, the equations $A_{1}=3 A, A_{2}=2 A, A_{3}=6 A, A_{4}=4 A, A_{5}=5 A$ also satisfy the general case.