4. Petl wrote on the board in a row $n$ two-digit octal numbers $(n \geqslant 2)$, forming an arithmetic progression with a common difference of 8, and the first number does not contain the digit 2. Vasya thought that this was the octal representation of a natural number $x$, and he factored $x$ into prime factors. It turned out that there were only two of them, and they differ by 2. What is written on the board?
Answer: 3343.

Solution. Let $y, z$ be the prime divisors of $x, z=y+2$. Note that the number $x+1$ equals $\left(\frac{y+z}{2}\right)^{2}$, meaning it is a perfect square. Let's write down the possible pairs $(y, z)$ in octal form:

$$
(\overline{\ldots a 1}, \overline{\ldots a 3}), \quad(\overline{\ldots a 3}, \overline{\ldots a 5}), \quad(\overline{\ldots a 5}, \overline{\ldots a 7}), \quad(\overline{\ldots a 7}, \overline{\ldots(a+1) 1})
$$

For the first and third pairs, the last octal digit of $x$ will be 3, and the second-to-last digit will be $-4 a \bmod 8$ or $(12 a+4) \bmod 8$. This digit is non-zero because the numbers in the progression are two-digit. Therefore, in both cases, it is 4, and the octal representation of $x$ ends in 43. Considering the condition, $x$ can take the values $3343_{8}$ or $13233343_{8}$. The first number fits, since

$$
x+1=3343_{8}+1=1764=42^{2} \quad \text { and } \quad x=41 \cdot 43 .
$$

Let $x=13233343_{8}$. Then

$$
(x+1) \bmod 3=(12-10+1) \bmod 3=0 \quad \text { and } \quad(x+1) \bmod 9=(12-10+1) \bmod 9=3
$$

Thus, the number $x+1$ is divisible by 3 and not by 9, so it is not a perfect square.

Now consider the second and fourth pairs in $(*)$. The last octal digit of $x$ will be 7, and the second-to-last digit will be 1 or 7. The first case cannot occur for $n \geqslant 2$, since the number $17_{8}-8$ is not two-digit. Therefore, considering the condition, the possible values of $x$ are:

$$
6777_{8}, 576777_{8}, 47576777_{8}, 3747576777_{8}, 17273747576777_{8}
$$

Note that $x+1=\ldots 7000_{8}=\ldots 78 \cdot 2^{9}$. Then the number $x+1$ is divisible by $2^{9}$ and not by $2^{10}$, so it is not a perfect square. Therefore, $x=3343_{8}$ is the only answer.