Bob repeatedly throws a (fair) coin. For each throw, there is a $4\%$ chance that Bob decides to stop throwing the coin. He records the number of heads H and the number of tails T before he stops flipping the coin (if he decides to stop flipping the coin on a toss, he doesn't record anything for that toss). Find the expected value of $|H-T|$.
Let $p=1/25$.
I'm not sure whether the expected value of $|H-T|$ after n+1 throws given that it is nonzero after n throws equals the expected value after n throws. Note that the probability that $H-T < 0$ after n flips and the (n+1)st throw is an H equals the probability that $H-T > 0$ and the (n+1)st throw is a T (we can simply replace H's with T's in the corresponding sequences). Also, the probability $H-T < 0$ and the (n+1)st throw is a T equals the probability that $H-T>0$ and the (n+1)st throw is an H. Also, the probability $H-T < 0$ after n throws and the (n+1)st throw is an H equals the probability $H-T<0$ after n throws and the (n+1)st throw is a T. Let $I$ be an indicator random variable equal to $-1$ if $H-T < 0$ and the (n+1)st throw is an H or $H-T > 0$ and the (n+1)st throw is a T and $1$ if $H-T > 0$ and the (n+1)st throw is a T or $H-T < 0$ and the $(n+1)$st throw is an H. I'm not sure about how to proceed from here.
Alternatively, I think it should be possible to find the expected value of $|H-T|$ assuming $n$ tosses were performed directly from the definition, and then compute the desired expected value using the fact that the probability n successful flips were performed (not including the last flip) is $p(1-p)^n$. Now if i is nonzero, then the probability that $|H-T| = i$ equals the probability $H-T = i$ plus the probability $H-T = -i$. In the first case, since $H+T = n, H = \dfrac{n+i}2, T = \dfrac{n-i}2$ while in the second case, $H = \dfrac{n-i}2, T = \dfrac{n+i}2.$ And clearly the probability $|H-T| = 0$ is ${n\choose n/2}$ assuming n is even; if not the probability is zero. So the expected value of $|H-T|$ is just $1/2^n \sum_{i=1}^n 2 {n\choose \dfrac{n+i}2} i,$ where ${n\choose k} := 0$ if $n$ is an integer but k is not. In particular, if $n$ is odd, then the expected value is $\dfrac{1}{2^n} \sum_{i=0}^{(n-1)/2} 2{n\choose \dfrac{n+2i+1}2} (2i+1)$ while if n is even, the expected value is $\dfrac{1}{2^n} \sum_{i=1}^{n/2} 2{n\choose \dfrac{n+2i}2}(2i).$
Question: how can I simplify the latter expression or come up with the expected value using a different method?
By computing a few small values, it seems that the last expression actually equals $\prod_{i=1}^{\lfloor (n-1)/2\rfloor } \dfrac{2i+1}{2i}$. Let us call the latter assumption assumption (*). I'm not sure how to prove this, so I'll just assume this is true from now on.
We have \begin{align} E(|H-T|) &= p\sum_{n=1}^\infty (1-p)^n \prod_{i=1}^{\lfloor (n-1)/2\rfloor } (2k+1)/(2k))\\ &= p(\sum_{m=0}^\infty (1-p)^{2m+1} \prod_{k=1}^m \dfrac{2k+1}{2k} + \sum_{m=0}^\infty (1-p)^{2m+2} \prod_{k=1}^m \dfrac{2k+1}{2k}) \\ &= p(1-p)(2-p) \sum_{m=0}^\infty (1-p)^{2m} \prod_{k=1}^m \dfrac{2k+1}{2k} \\ &= p(1-p)(2-p) (1-(1-p)^2)^{-3/2}\\ &= (1-p)/\sqrt{p(2-p)}, \end{align}
and so plugging in $p=1/25$ gives that the expected value is $24/7$ under assumption (*).