$f (x) = 1$ if the digit $9$ appears in the decimal representation of $x$ and $f (x) = 0$ otherwise — show that $f$ is continuous 
The function $f : [0, 1] \to \Bbb R$, where $f (x) = 1$ if the digit $9$ appears in the decimal representation of $x$ and $f (x) = 0$ otherwise. We use a decimal representation that does not end in repeating $9$s.  Show that $f$ is continuous at $x$ if and only if $f (x) = 1$.  (Use only $\varepsilon$, $\delta$ definition of continues. You are not allowed use limit).


I intuitively know that if $x$ is a decimal which appears $9$ then we can find another decimal in any neighbourhood with the same property. if not then again we can find another decimal in any neighbourhood which appears $9$. But how write it formally I couldn't. After several days I gave up. Actually I understand the basic idea. But I couldn't write formally anything. Please help me.

The set of numbers with a $9$ in the decimal representation is dense in $[0, 1]$ (just replace the $n$-th digit by $9,$ for some high $n.$) This shows that the function is not continuous if it is $0.$ On the other hand, the set of numbers which do not have a nine is not dense (a number which has a nine in the $k$-th position will have it if perturbed by something smaller than $10^{-k-2}.$)
