Am I wanting to perform a random walk? I am trying to determine the best method to obtain a probability distribution that describes the likelihood of flipping only heads for a number of successive coin tosses with a coin that has an unknown probability of landing heads.
I have a prior for the probability of the coin landing heads, described by a beta distribution:
$$\beta(a,b)$$
I am updating this distribution according to the number of successes ('heads') $y$ from trials $n$:
$$\beta(a+y, b+n-y)$$
What is the best way to do this, or at least a relatively efficient way?
My lazy (and potentially incorrect) way of doing this has been to arbitrarily choose some upper bound of trials I will consider, say $n = 20$, update the probability distribution for each $n$, e.g. $n = 1,2,3,...,20$, and then aggregate the distributions. However, I'm not happy with this approach.
I have started looking into markov chains (and random walks) and associated sampling methods e.g. gibbs sampling which seem relevant but I'm not sure if they are or how to apply them.

Let's assume the following:

*

*The distribution of heads out of N coin flips follows a binomial $\text{Bin}(N, \pi)$ distribution conditional on the unknown probability of heads $\pi$.

*You have a belief about the probability $\pi$ that can be captured either by a beta distribution or can be approximated by a mixture of beta distributions.

In that case, the probability of getting $Y=N$ heads out of $N$ coin flips is given by the probability mass function of the beta-binomial distribution (or a mixture of beta-binomials with the same weights as the mixture weights for the beta-mixture describing your belief about $\pi$) evaluated at $y=N$.
Most other quantities I can think of should have nice closed-form solutions (e.g. via the pmf or cumulative distribution function of the beta-binomial, or e.g. via the beta-negative-binomial), so sampling based solutions (e.g. Markov-Chain-Monte-Carlo) are unnecessary (and will take a good bit longer). But, of course you can also take a sampling approach, if you cannot easily find a closed form solution.
