# Baby Rudin Problem Chapter 2, Problems 17(c) and (d)

Let $E$ be the set of all $x \in [0,1]$ whose decimal expansion contains only the digits $4$ and $7$. Then I've managed to show that (a) $E$ is not countable, and (b) $E$ is not dense in $[0,1]$.

How to determine if $E$ is closed (and hence compact)?

And, if closed, then how to determine if $E$ is perfect?

My effort:

Suppose $y \in [0,1] - E$, and let $n$ be the smallest natural number such that the $n$th digit after the decimal point $d_n$ in the decimal expansion of $y$ is neither $4$ nor $7$.

Let us take $\epsilon$ such that $$0 < \epsilon < \frac{\min (|d_n-4|, |d_n-7|)}{10^{n+1}}.$$ Then is it true that this $\epsilon$-neighborhood of $y$ contains no point of $E$? If so, then how to show this fact rigorously? If this holds, then of course no point $y$ not in $E$ can be a limit point of $E$, implying that $E$ is closed.

To see if $E$ is perfect, let $x$ be an arbitrary element of $E$, and let the decimal expansion of $x$ be as follows: $$x \colon = \sum_{i=1}^\infty \frac{d_i}{10^i},$$ where each $d_i$ is either $4$ or $7$. Let $\epsilon > 0$ be arbitrary. Let's choose $n$ such that $$\frac{4}{10^{n}} < \epsilon.$$ Now we can find an element $y$ of $E$ whose decimal expansion is given by $$y \colon = \sum_{i=1}^\infty \frac{d^\prime_i}{10^i},$$ where $$d^\prime_i \colon= \begin{cases} d_i \mbox{ if } i \neq n; \\ 4 \mbox{ if } i =n \mbox{ and } d_n = 7; \\ 7 \mbox{ if } i=n \mbox{ and } d_n = 4.\end{cases}$$ Then evidently, we have $$d(x,y) = \frac{3}{10^n} < \epsilon,$$ and moreover $y \in E$ and $y \neq x$. So $x$ is a limit point of $E$. Thus every point of $E$ is a limit point.

Now is $E$ closed?

Yes $E$ is closed.
Take $y \in [0,1] - E$, then for any $x\in E$, suppose $x$ and $y$ has the first different decimal at the position of $\dfrac{1}{10^m}$, then we can show $|x-y| \geq \dfrac{1}{3\cdot 10^{m+1}}$. Because the largest compensation coming from all the later decimanls is $\sum_{k=m+1}^{+\infty}\dfrac{6}{10^{k}} = \dfrac{2}{3\cdot 10^m}$
Now let $n$ be the smallest natural number such that the nth digit after the decimal point in the decimal expansion of $y$ is neither $4$ nor $7$, as you defined, then we see $m \leq n$, then $$|x-y| \geq \dfrac{1}{3\cdot 10^{m+1}}\geq \dfrac{1}{3\cdot 10^{n+1}},\forall x\in E$$