1. 18 Find all natural numbers $n$: in decimal notation, every $n$-digit number consisting of $n-1$ ones and one 7 is a prime number.
[Solution] Let $m$ be an $n$-digit number consisting of $n-1$ ones and one 7, then it can be written in the following form:
$$
m=A_{n}+6 \times 10^{k}.
$$

Here $A_{n}$ is an $n$-digit number consisting of $n$ ones, and $0 \leqslant k \leqslant n-1$.
If $n$ is divisible by 3, then the sum of the digits of $m$ is divisible by 3, hence $m$ is not a prime number.
If $n$ is not divisible by 3, let
$$
A_{n} \equiv r(\bmod 7),
$$

Since
$$
10^{0} \equiv 1,10^{1} \equiv 3,10^{2} \equiv 2,10^{3} \equiv 6,10^{4} \equiv 4,10^{5} \equiv 5 \quad(\mathrm{mod}
$$
7).

And $A_{1} \equiv 1, A_{2} \equiv 4, A_{3} \equiv 6, A_{4} \equiv 5, A_{5} \equiv 2, A_{6} \equiv 0(\bmod 7)$,
Therefore, only when $61 n$, we have
$$
A_{n} \equiv 0(\bmod 7).
$$

Now $3 \times n$, so $r \neq 0$.
If $n \geqslant 6$, then we can always choose $k,(0 \leqslant k \leqslant 5)$, such that
$$
6 \times 10^{k} \equiv-10^{k} \equiv -r(\bmod 7),
$$

Thus
$$
m=A_{n}+6 \times 10^{k} \equiv r+7-r \equiv 0(\bmod 7),
$$

Therefore, $m$ is not a prime number, so we only need to check the cases $n=1,2,4,5$:
For $n=1$, 7 is a prime number.
For $n=2$, both 17 and 71 are prime numbers.
For $n=4$, it is not hard to see that $1711=29 \times 59$.
For $n=5$, using the table above, it is not hard to see that
$$
A_{5}+6 \times 10^{2}=11711 \equiv 0(\bmod 7).
$$

Therefore, only $n=1$ or 2 are the solutions.