I have the following conundrum
I want to toss a coin up to 5 times until I get a head.
If I get a tail, I retoss the coin if coin toss is less than 5 times.
So I could get the following
1 head
1 tail 1 head
2 tails in a row then 1 head
3 tails in a row then 1 head
4 tails in a row then 1 head
5 tails
I thought I could use binomial distribution function to calculate the odds for each but the formula doesnt take into account the specific order. I can work it out on a piece of paper e.g.TH, TTH etc finding all my relevant combinations, but there must be a neater way.
I then wanted to run this simulation multiple times to get a 95% confidence rate. How would I achieve this ?
Thanks in advance
I want to toss a coin up to 5 times until I get a head.
If I get a tail, I retoss the coin if coin toss is less than 5 times.
So I could get the following
1 head
1 tail 1 head
2 tails in a row then 1 head
3 tails in a row then 1 head
4 tails in a row then 1 head
5 tails
I thought I could use binomial distribution function to calculate the odds for each but the formula doesnt take into account the specific order. I can work it out on a piece of paper e.g.TH, TTH etc finding all my relevant combinations, but there must be a neater way.
I then wanted to run this simulation multiple times to get a 95% confidence rate. How would I achieve this ?
Thanks in advance