Perfect set without rational numbers [duplicate]

I didn't look at the links posted in the comments. I may repeat an argument there in the below.

Suppose $E$ is the set of all $x\in [0,1]$ such that $x$ has a decimal expansion of the form

$$\tag 1 .\text {_} 0 \text {_ _} 0 \text {_ _ _} 0 \text {_ _ _ _} 0 \dots ,$$

where the entries in the blanks _ are either $1$ or $2.$ Such expansions are unique; we don't run into the "string of $9$'s" business. Therefore $E$ has the same cardinality as the set of binary sequences, hence is uncountable.

Because the expansions in $(1)$ are nonrepeating, $E$ contains no rational. If a sequence in $E$ converges, the corresponding decimal expansions converge in each slot (we don't run into the $.4999\bar 9 = .5000\bar 0$ problem). Hence $E$ is closed.

Finally $E$ is perfect: Let $x\in E.$ Suppose $x$ has infinitely many $1$'s in its expansion, say in the slots $n_1,n_2, \dots.$ Then $x+1/10^{n_k} \to x,$ and each $x+1/10^{n_k} \in E.$ If $x$ had $2$'s in the slots $n_1,n_2, \dots,$ we would instead look at $x-1/10^{n_k} \to x.$ So $E$ is perfect as desired.


The irrationals are homeomorphic to the space $\Bbb N^{\Bbb N}$ with the product topology; you’ll find two proofs here. The Cantor set is well-known to be homeomorphic to $\{0,1\}^{\Bbb N}$ with the product topology, where $\{0,1\}$ has the discrete topology. Thus, if $h:\Bbb N^{\Bbb N}\to\Bbb R\setminus\Bbb Q$ is a homeomorphism, $h\left[\{0,1\}^{\Bbb N}\right]$ is a Cantor set contained in the irrationals.