How much time to toss a coin knowing the digit numbers of the answer? 
Let $S_k$ be the set of positive integers whose base-10 expansion contains exactly $k$ elements (so that, for example, $1024 \in S_4$). A fair coin is tossed until the first head appears, and we write $T$ for the number of tosses required. We pick a random element, $N$ say, from $S_T$, each such elements having the same probability.
What is the mass function of $N$?

from Ch3 of Discrete random variables in One Thousand Exercises in Probability by Geoffrey Grimmett and David Stirzaker.
The answer given by the book is:

Let $D_k$ be the number of digits (to base $10$) in the integer $k$. Then:
$$P(N=k)=P(N=k|T=D_k)P(T=D_k)$$
$$=\frac{1}{|S_{D_k}|}2^{-D_k}$$

I understand it comes from :
$$P(N=k|T=D_k)=\frac{P(N=k\bigcap T=D_k)}{P(T=D_k)}$$
$$\Leftrightarrow P(N=k|T=D_k)=\frac{P(N=k)}{P(T=D_k)}$$
$$\Leftrightarrow P(N=k)=P(N=k|T=D_k)P(T=D_k)$$
I don't understand what $P(N=k)$ means:
Are we expecting the tossing time until the first head appears?
For instance does
$P(N=1024)=P(N=1024|T=4)P(T=4)$
means that we are searching the probability of tossing 1024 times a coin, and this probability would be equal to:
$$=\frac{1}{9000}\frac{1}{2⁴}?$$
By the way, I thought this book was a reference but in English buyt my test will be in French, do you advise me to continue studying with this book or take a French one?
 A: When I am being asked about the probability of the occurrence of the event $\{N=k\}$, where $k$ has $D_k$ digits, I am being implicitly asked also about the occurrence of the event $\{T = D_k
\}$, that is, in order to $\{N=k\}$ occurs, $\{T = D_k
\}$ has also to occur, and that is why $P(N=k) = P(N=k \cap T=D_k)$. For example, if we are asked about $P(N=13)$, we are actually being asked about $P(N=13 \cap T=2)$, $N$ can only takes the value of $13$ when $T=2$.
To better understand this, is good to use the total probability theorem and write
$$P(N = k) = \sum_{t=1}^\infty P(N=k \cap T = t)$$
The following tree tries to illustrate the concept:
$\hspace{3cm}$
For each branch of the first stage (a value of $T$) there are a set of possible values for $N$. Although I put the values of $N$ next to a leaf and not over a branch of the second stage, actually each leaf represent the intersection of the events that you encounter going from the root of tree up to that leaf, what in general appears in the above equation as $\{N=k \cap T = t\}$. In this way the leaves represent all the possible results in your experiment, and what the theorem is saying to us is that to compute $P(N=k)$, we must sum the probabilities of all the leaves or results where $N=k$. Thus, for example, if we want to compute $P(N=13)$, we have to sum the probability of all the leaves where $N=13$, and in that case there is only one, the one where $N=13$ and $T=2$.
From above can be seen that you are going to end up with the fact that, for a given value of $k$, there is only one value of $T$ where $P(N=k \cap T = t)$ is not zero, and we have called to that value $D_k$, the number of digits of $k$. Therefore, you get
$$P(N=k) = P(N=k \cap T = D_k)$$

Update
$$P(N=k) = P(N=k \cap T = D_k) = P(N=k \mid T=D_k)P(T=D_k)$$
Given that $T=D_k$, $N$ is a number that belongs to the set $S_{D_k}$ (the set of positive integers with $D_k$ digits), where all the elements are equiprobable,
$$P(N=k \mid T=D_k) = \frac{1}{\lvert S_{D_k}\rvert}$$
By other hand, $T=D_k$ means that the number of tosses of the coin up to the first head is $D_k$, that is, that the sequence of tosses was $D_k-1$ tails and 1 head, therefore
$$P(T=D_k) = (0.5)^{D_k-1}(0.5) = (0.5)^{D_k}$$
