2
$\begingroup$

Problem: Every roll has 4 outcomes: 1, 2, 3 and 4 There are 50% chance for 1-3 at every roll. (And that means 50% for 4) If one roll did not give 1-3 at one roll, then it is 100% chance at the roll after. (So every second roll is guaranteed to be either 1, 2 or 3) If rolled 1, 2 or 3 then there is equal chance of either 1, 2 or 3.

So: 1/6 chance of 1, 1/6 chance of 2, 1/6 chance of 3, 1/2 chance of 4, If last roll were 4 or it is the first roll.

Success: six 1's, six 2's or six 3's. So I need 6 rolls of either 1, 2 or 3.

Example: 1,4,1,2,3,4,1,1,1,1 (now there is 6 1's)

Notes: I know that after 32 rolls there are 100% chance of six rolls of either 1, 2 or 3.

Question: When do I have 80% chance of 6 rolls of either 1, 2 or 3?

Edit 1: If we ignore that I cannot roll two fours in a row then:

I could work backwards: there is 1-((1/6)^5)*(1/2)=0,9999356996 of not getting it in the first 6 rolls.

Then what about 7 rolls? There is 5/6 chance of not hitting a number that matches. (1-((1/6)^5)(1/2))(5/6)=0.8332797497

So with 9 extra rolls: (1-((1/6)^5)(1/2))(5/6)^9=0,1937942376 I hit below 20% probability of not hitting 6 equals. That is 15 rolls.

If I did consider that I could not get two fours in a row, then it would take even fewer extra rolls; Because the probability would be even better. I just dont know exactly how much.

Right?

Edit 2 I see some great answers below that I will look at soon. Here is just an idea I were thinking about.

Initially we forget the 4's. That would give:

(1-((1/3)^5)*(1/2))*(5/3)^4=0,1975308642

Meaning 6+4=10 rolls if there is never rolled a four.

If there were a 100% chance of rolling a four, but not two fours in a row; then we would just multiply with two: 20 rolls.

But now that the probability is 50%, then I must ask how many 4's is there "in between" non-four rolls after 10 rolls. Again it must be a range, so I would like to know the 80% chance again.

(1-((1/2)^8))*(1/2)^(10-8)=0,2490234375

But that does not seem right, and maybe my whole method is wrong then.

I will take a look at the others answers now :)

$\endgroup$
7
  • $\begingroup$ If I understand the game correctly, I think you only need 32 rolls to ensure a 100% chance of success. $\endgroup$
    – fblundun
    Commented Oct 28, 2021 at 13:13
  • $\begingroup$ Are 1, 2 and 3 of equal probability? $\endgroup$
    – Bernhard
    Commented Oct 28, 2021 at 13:20
  • $\begingroup$ @bernhard correct, edited the description. $\endgroup$ Commented Oct 28, 2021 at 13:26
  • $\begingroup$ @fblundun: ahh true. Will edit the text. $\endgroup$ Commented Oct 28, 2021 at 13:27
  • $\begingroup$ this is very difficult. doing simulations seems the fastest way out of it. $\endgroup$
    – carlo
    Commented Oct 28, 2021 at 15:31

1 Answer 1

3
$\begingroup$

To take $r$ rolls, you have to get

  • $6$ rolls of one of the three numbers $1,2,3$,
  • and $a$ rolls of the next with $0\le a \le 5$,
  • and $b$ rolls of the other with $0\le b \le 5$,

being able to do that ${5+a+b \choose 5}{a+b \choose a}$ different ways since the final attempt must be the desired number,

  • and $r-6-a-b$ rolls of the number $4$

out of the $6+a+b$ places you might have done it so in ${6+a+b \choose r-6-a-b}$ ways $\big($or $0$ ways if $r <6+a+b$ or if $6+a+b < \frac{r}{2}\big)$.

So I think the probability you take $r$ rolls is $$\sum\limits_{a=0}^{5} \sum\limits_{b=0}^{5} \frac{3}{6^{6+a+b}} {5+a+b \choose 5}{a+b \choose a}{6+a+b \choose r-6-a-b}$$

Using R to calculate this

probs <- function(r){
  f <- function(a,b){
    3 * choose(5+a+b, 5) * choose(a+b, a) *
        choose(6+a+b, r-6-a-b)  / 6^(6+a+b)
    }
  sum(outer(0:5,0:5,f))
  } 
probrolls <- numeric(32)
for (n in 1:32){
  probrolls[n] <- probs(n)
  }
sum(probrolls) # check adds up to 1
# 1
sum(probrolls*(1:32))  # expected number 
# 18.27188

The probabilities and cumulative probabilities are as follows, so to have at least an $80\%$ chance of $6$ rolls of either $1$, $2$ or $3$ appears to need $22$ rolls.

cbind(probrolls, cumprob=cumsum(probrolls))
         probrolls      cumprob
 [1,] 0.000000e+00 0.000000e+00
 [2,] 0.000000e+00 0.000000e+00
 [3,] 0.000000e+00 0.000000e+00
 [4,] 0.000000e+00 0.000000e+00
 [5,] 0.000000e+00 0.000000e+00
 [6,] 6.430041e-05 6.430041e-05
 [7,] 5.144033e-04 5.787037e-04
 [8,] 2.014746e-03 2.593450e-03
 [9,] 5.320264e-03 7.913714e-03
[10,] 1.096679e-02 1.888051e-02
[11,] 1.915676e-02 3.803727e-02
[12,] 2.974389e-02 6.778115e-02
[13,] 4.227031e-02 1.100515e-01
[14,] 5.602002e-02 1.660715e-01
[15,] 7.001649e-02 2.360880e-01
[16,] 8.299626e-02 3.190842e-01
[17,] 9.345859e-02 4.125428e-01
[18,] 9.987578e-02 5.124186e-01
[19,] 1.010285e-01 6.134471e-01
[20,] 9.633151e-02 7.097786e-01
[21,] 8.604229e-02 7.958209e-01
[22,] 7.132705e-02 8.671480e-01
[23,] 5.417352e-02 9.213215e-01
[24,] 3.707282e-02 9.583943e-01
[25,] 2.240174e-02 9.807961e-01
[26,] 1.167466e-02 9.924707e-01
[27,] 5.105289e-03 9.975760e-01
[28,] 1.811591e-03 9.993876e-01
[29,] 4.989406e-04 9.998865e-01
[30,] 9.978811e-05 9.999863e-01
[31,] 1.287589e-05 9.999992e-01
[32,] 8.047428e-07 1.000000e+00

As a check, here is a simulation of $10^5$ cases that comes close to that result and those probabilities

runofrolls <- function(){
   appearances <- numeric(4)
   while (max(appearances[1:3]) < 6){
     roll <- sample(1:4, 1, prob=c(1/6,1/6,1/6,1/2))
     appearances[roll] <- appearances[roll] + 1
     if (roll == 4){
       nextroll <- sample(1:3, 1, prob=c(1/3,1/3,1/3))
       appearances[nextroll] <- appearances[nextroll] + 1
       }
     }
   return(sum(appearances))
   }

set.seed(2021)    
sims <- replicate(10^5, runofrolls()) 
mean(sims)
# 18.26183 
quantile(sims, 0.8)
# 80% 
#   22 
mean(sims <= 21)  
# 0.79601
mean(sims <= 22)  
# 0.86814
$\endgroup$
4
  • $\begingroup$ @SextusEmpiricus No - I am consider the possibilities immediately before the $6+a+b$ rolls of $1,2,3$, and each time you can have $0$ or $1$ rolls of $4$ but no more. $\endgroup$
    – Henry
    Commented Oct 28, 2021 at 23:56
  • $\begingroup$ I see, you split the $6+a+b$ into a group of $n_4 = r-6-a-b$ that have a 4 in front of it and a group of $6+a+b-n_4$ that do not have a 4 in front of it. $\endgroup$ Commented Oct 29, 2021 at 0:12
  • $\begingroup$ @SextusEmpiricus There is a factor of $\dfrac{1}{2^{r-6-a-b}}$ for where $4$ appears and $\dfrac{1}{2^{12+2a+2b-r}}$ where $4$ does not appear. Multiply them together and you get $\dfrac{1}{2^{6+a+b}}$. Multiply that by $\dfrac{1}{3^{6+a+b}}$ and you get $\dfrac{1}{6^{6+a+b}}$. $\endgroup$
    – Henry
    Commented Oct 29, 2021 at 0:20
  • $\begingroup$ @SextusEmpiricus In response to your question about $ \frac{3}{6^{6+a+b}}$ lacking $r$, the $3$ comes from "$6$ rolls of one of the three numbers $1,2,3$"; there are ${3 \choose 1}=3$ ways of choosing it. As my previous comment explained, $\dfrac{1}{6^{6+a+b}} = \dfrac{1}{3^{6+a+b}} \times \dfrac{1}{2^{r-6-a-b}} \times \dfrac{1}{2^{12+2a+2b-r}}$ $\endgroup$
    – Henry
    Commented Oct 29, 2021 at 0:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.