Posterior coin count after exactly one head (source code)

= Posterior coin count after exactly one head
{title2=$P(N=n\mid H=1)=n(1-r)^2r^{n-1}$}

Let $N$ have the positive-integer <geometric distribution> with success parameter $p\in(0,1)$, and conditionally toss $N$ independent coins with head <probability> $\theta\in(0,1)$. Exactly one head has conditional <probability> $n\theta(1-\theta)^{n-1}$. Combining this with the prior by <Bayes theorem> gives the displayed posterior with $r=(1-p)(1-\theta)$; its normalization uses $\sum_{n\geq1}nr^{n-1}=(1-r)^{-2}$. For $p=\theta=1/2$, the posterior is $9n/4^{n+1}$. It is also a shifted <negative binomial distribution>, with $N-1$ equal in law to the number of failures before two successes of <probability> $1-r$.