4. The number 12320 is written on the board. Petya appended $10 n+1$ threes to it on the right, where $n-$ is a non-negative integer. Vasya thought that this was the quaternary (base-4) representation of a natural number $x$, and he factored $x$ into prime factors. It turned out that there were exactly two distinct primes among them. For which $n$ is this possible?
Answer: $n=0$.

Solution. We agree to write quaternary numbers in parentheses to distinguish them from decimal numbers. Then

$$
x=(12320 \underbrace{33 \ldots 3}_{10 n+1})=(12321 \underbrace{00 \ldots 0}_{10 n+1})-1=441 \cdot 4 \cdot 4^{10 n}-1=\left(42 \cdot 1024^{n}-1\right)\left(42 \cdot 1024^{n}+1\right) .
$$

If $n=0$, then $x=41 \cdot 43$, which fits our requirement. Let $n \geqslant 1$. Note that

$1024 \bmod 41=32^{2} \bmod 41=(-9)^{2} \bmod 41=-1, \quad$ from which $\quad 1024^{n} \bmod 41=(-1)^{n}$.

Let $a=42 \cdot 1024^{n}-1, b=42 \cdot 1024^{n}+1$. These numbers are coprime, as they are odd and differ by 2. Consider two cases.

1) $n$ is even. Then $a$ is divisible by 41. But $a$ and $b$ have no common prime divisors, so $a=41^{p}$ for some natural $p$. We get

$$
41^{p}-1=42 \cdot 1024^{n}-2=2\left(21 \cdot 1024^{n}-1\right)
$$

which is impossible, since the left side is divisible by 4, while the right side is not.
2) $n$ is odd. Then $b$ is divisible by 41 and, similarly, $b=41^{q}$ for some natural $q$. Therefore

$$
41^{q}-1=42 \cdot 1024^{n}
$$

which is impossible, since the left side is divisible by 5, while the right side is not.