We flip a coin $n$ times. The probability of tails is $p$.
Let $X$ be the number of occurrences of a run of heads followed by a longer run of tails. We can also agree that if the sequence begins with a run of tails that is also an occurrence (though I believe it doesn't matter in the limit as $n \to \infty$). Here are some examples:
- $HT$: value of $X = 0$
- $H\color{red}{TT}HHT$: value of $X = 1$
- $\color{red}{TT}HH\color{red}{TTT}$: value of $X = 2$
- $H\color{red}{TT}HHHTTH\color{red}{T}H\color{red}{TTT}$: value of $X = 3$
Let's define the function
$$ f_n(p) = \mathbb{E}[X]. $$
Our question concerns the value of $p$ that maximizes $f_n$ in the limit as $n \to \infty$:
Calculate $$ \lim_{n \to \infty} \arg \max_{0\leq p \leq 1} f_n(p)$$
Disclaimer: I invented this problem and have solved it myself. But I'm posting this because I think it's a nice problem and the answer turned out nice. I'm not giving my answer yet so as not to spoil it and if someone else gets the same we have verification. I thought about posting to puzzlingSE if it's more suitable but joining that community didn't work atm. If the question should be migrated there that's OK.