4. Petl wrote on the board in a row $n$ two-digit octal numbers ( $n \geqslant 2$ ), forming an arithmetic progression with a difference of -8. 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 6. What is written on the board?
Answer: 7767.

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

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

In the first case, the octal representation of $x$ ends in 07, which is impossible since the numbers in the progression are two-digit. For the third pair, the last octal digit of $x$ will be 7, and the second-to-last digit will be $-(8 a+5+1) \bmod 8=6$. Then, considering the condition $n \geqslant 2$, we get $x=7767_{8}$. This works because

$$
x+9=7767_{8}+9=4096=64^{2} \quad \text { and } \quad x=61 \cdot 67 .
$$

Now consider the second and fourth pairs in (*). The last octal digit of $x$ will be 3, and the second-to-last digit will be $-(4 a+3) \bmod 8$, since $(7(a+1)+5 a+4) \bmod 8=(4 a+3) \bmod 8$. Odd $a$ do not work under the condition $n \geqslant 2$, as the number $73_{8}+8$ is already three-digit. Therefore, the octal representation of $x$ ends in 33. Thus, $x$ could be one of the numbers

$$
4333_{8}, 534333_{8}, 63534333_{8}, 7363534333_{8}
$$

The second and third do not work, as they are divisible by 3 (the sums of the digits in even and odd positions differ by 3 and 6, respectively). Moreover,

$$
\left(4333_{8}+9\right) \bmod 3=(6-7+9) \bmod 3=2 \quad \text { and } \quad\left(7363534333_{8}+9\right) \bmod 3=(15-25+9) \bmod 3=2 .
$$

Therefore, the numbers $4333_{8}+9$ and $7363534333_{8}+9$ are not perfect squares, which is impossible. Thus, $x=7767_{8}$ is the only answer.