Task 2 - 331032
For each positive integer \(n\), imagine another number \(n^{\prime}\) formed according to the following rule: From the digit representation of \(n\) in the decimal system, the first digit is removed and appended instead after the last digit. Then let \(n^{\prime}\) be the number with the resulting digit representation. (In this digit representation of \(n^{\prime}\), the possibility of a leading zero is also allowed if the second digit of \(n\) was a zero.)

Investigate whether there are numbers \(n\) divisible by 7 for which \(n^{\prime}=n: 7\) holds!

Determine, if such numbers exist, the smallest among them!
}

There are such numbers \(n\), the smallest of which is

\[
n=10^{21}+\frac{10^{21}-7}{69}
\]

Let \(1 \leq a<10\) be the first digit of \(n\) and \(0 \leq b<10^{k}\) be the integer formed by the remaining digits of \(n\). Furthermore, let \(k+1\) be the number of digits of \(n\), so that \(n=10^{k} a+b\) and \(n^{\prime}=10 b+a\). From \(n^{\prime}=n: 7\) it follows that

\[
10^{k} a+b=7(10 b+a)
\]

If we bring all terms with \(a\) to the left side and all terms with \(b\) to the right side, we get

\[
\left(10^{k}-7\right) a=69 b
\]

Since the right side of the equation is divisible by 23, the left side must also be divisible by 23. Since 23 is a prime number and \(a<10\), \(10^{k}-7\) must be divisible by 23. Indeed, \(10^{k}-7\) is divisible by 23 for \(k=21\) and not divisible by 23 for \(0<k<21\). Thus, it is shown that \(k \geq 21\) must hold. Moreover, \(10^{21}-7\) is even divisible by 69.

The choice \(a=1, b=\frac{10^{21}-7}{69}\) and \(k=21\) satisfies our properties, especially \(a \geq 1\) and \(b<10^{21}\). Furthermore, \(n\) is minimal for this choice, since \(k \geq 21\) and \(a \geq 1\) must hold, and \(b=\frac{10^{21}-7}{69}\) holds for \(k=21\) and \(a=1\).

Let \(r_{k}\) be the remainder of \(10^{k}\) when divided by 23, so we have

\[
r_{k+1}=10 r_{k} \bmod 23, \quad r_{0}=1
\]

We determine the remainders recursively. If we find a \(k\) with \(r_{k}=7\), we stop. If we do not find such a \(k\), we stop at \(k=22\), since then none will occur anymore.