# How to find $k$-th number whose digits are all even?

As my question says I have to find $k$-th number whose digits are all even. I figure out that all those numbers are made of of $\{0,2,4,6,8\}$ and there is a sequence in which the numbers change their value like:$$0,2,4,6,8,20,22,24,26,28,40,42,44,46,48\dots80,82,84,86,88,200,202,204,206,208\dots$$ But I am unable to figure out some kind of formula or short way to reach the $k$-th such number easily.

• Note that this is a duplicate of math.stackexchange.com/questions/1818439/… (but neither question has an answer yet). – almagest Jun 8 '16 at 13:21
• Half all the digits. What sequence do you get then? – Henno Brandsma Jun 8 '16 at 13:24
• half the digits will be: {0,1,2,3,4,10,11,12,13,14,20,21,22,23,24......and so on}.....how does it help me?? – agangwal Jun 8 '16 at 15:14

Let's denote digits $\{0,2,4,6,8\}$ as $\{0,1,2,3,4\}$. Then sequence represents as $$0, 1, 2, 3, 4, 10, 11, 12, \dots ,40, 41, 42,43, 44, 100, 101,\dots$$ which is looks like numbers in base-$5$ positional notation. So if we want to find $k_{10}$-th (index $10$ means $k$ is in decimal notation) we need to take number $k_5$ and replase digits as we did it in the beginning, i.e. using substitution $$\begin{pmatrix} 0 & 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 6 & 8 \end{pmatrix}.$$

For example, let's calculate numeber from this sequence with number $8$. As $8_{10} = 1\cdot 5^1 + 3\cdot 5^0 = 13_5$ we get number $26$ (replacing in $13$ digits $1$ with $2$ and $3$ with $6$) which is correct. Note that we count $1$ as first number, not zero.