4. What is the smallest natural number $\mathrm{N}$ by which 999,999 must be multiplied so that the result is a number written entirely with ones
Solution. Note that $999999=10^{6}-1$. A number written with all ones has the form $\frac{1}{9}\left(10^{n}-1\right)$. Therefore, the condition of the problem means that

$\left(10^{6}-1\right) \cdot N=\frac{10^{n}-1}{9}$, i.e., $N=\frac{1}{9} \cdot \frac{10^{n}-1}{10^{6}-1}$.

Now note that if $n=6 k+r$, then $10^{n}-1=\left(10^{6 k+r}-10^{r}\right)+10^{r}-1$. The expression in the first parentheses is divisible by $10^{6}-1$, so $10^{n}-1$ is divisible by $10^{6}-1$ only when the remainder $10^{r}-1=0$, i.e., $r=0$, and thus, $n=6 k$. Therefore,

$$
N=\frac{1}{9} \cdot \frac{10^{6 k}-1}{10^{6}-1}=\frac{1}{9} \cdot\left(10^{6 k-6}+10^{6 k-12}+\ldots+10^{6}+1\right)
$$

The number in parentheses is divisible by 9 when the sum of its digits is divisible by 9. However, the decimal representation of this expression consists only of 0 and 1, and the number of ones is $k$. Therefore, the smallest value of $k$ for which $N$ will be an integer is 9. In this case, $n=54$ and

$$
N=\frac{1}{9} \cdot\left(10^{48}+10^{42}+10^{36}+10^{30}+10^{24}+10^{18}+10^{12}+10^{6}+1\right)=
$$