# A very confusing statistics problem from a high school math student

I have just made an account to ask this question, since nobody has been able to clear up my confusion as of yet. I am a high school student so if I am using incorrect terminology or notation I do apologize for any confusion that may occur.

Say that one were to roll two fair, 6 sided dice, such that each number 1-6 has an equal chance of appearing. After the first roll, the sum of the presenting faces is recorded on a table as 'N', the 1st term in a sequence. To continue the sequence, the dice are rolled N amount of times. There are two possibilities during this 'rolling period:'

If during this rolling period a sum of N appears before the final roll, the remaining rolls are discarded and the number N is recorded as the next term in the sequence.

If during this rolling period a sum of N does not appear at any time, the sum of the faces on the Nth roll are recorded as the next term in the sequence.

I have two questions here about the resulting sequence from this procedure.

1: If the sequence is continued to the 10th term, what is the probability that the sequence consists of all 7s?

2: Now assume that N was determined to be 7, and is not included in the resulting sequence. The rest of the procedure is unchanged. If the sequence is continued infinitely, and each term is placed into a bar graph recording the prevalence of each possible sum, would the graph present a standard bellcurve?

I came up with this situation and both questions while sitting in a Adv. Algebra 2/Trig class. I have solved the first question (I think), however I am both unable to answer the second question and very curious about the answer. If anybody wants to take a crack I'd be interested in seeing how this situation is approached. If anything is unclear or confusing let me know so that I can clarify.

• One detail right away: there's no awy that the bar graph in (2) can present a standard bell curve, because there are only 11 possible values (and a standard bell curve, which is continuous, has infinitely many possible values). Apr 16, 2021 at 17:00
• The standard method for solving (2) is to compute, for all $N_0$ and $N_1$ in $\{2,\dots,12\}$, the probability that when the starting sum is $N_0$ the ending sum is $N_1$. Those probabilities can be placed into a state transition matrix, and then linear algebra can determine the limiting distribution of the prevalences of each possible sum. Apr 16, 2021 at 17:03
• I should have clarified, by 'standard bellcurve' I mean a graph that is consistent with the most frequent and surrounding 9 values of a standard bellcurve. Apr 16, 2021 at 17:04

• In a single roll, the probability of rolling $$N$$ is $$p_N^{\,}=\frac{6-|N-7|}{36}$$.

• For example with $$N=7$$ this is $$\frac{6-|7-7|}{36}=\frac{6-0}{36}=\frac{1}{6}$$.
• The probability of rolling a number which is not $$N$$ is $$1-p_N^{\,}$$.

• For example with $$N=7$$ this is $$1-\frac{1}{6}=\frac56$$.
• The probability of $$N$$ times rolling a number which is not $$N$$ is $$\left(1-p_N^{\,}\right)^N$$.

• For example with $$N=7$$ this is $$(\frac56)^7=\frac{78125}{279936}$$.
• The probability of rolling $$N$$ in up to $$N$$ attempts is $$1-\left(1-p_N^{\,}\right)^N$$.

• For example with $$N=7$$ this is $$1-\frac{78125}{279936}=\frac{201811}{279936}$$.
• The probability of rolling $$N$$ initially and again in up to $$N$$ following attempts is $$p_N^{\,}\left(1-\left(1-p_N^{\,}\right)^N\right)$$.

• For example with $$N=7$$ this is $$\frac{1}{6}\times\frac{201811}{279936}= \frac{201811}{1679616}\approx 0.1201531$$.
• The probability of initially rolling some other number (let's say $$M$$ but we will have to sum over these) then failing to hit $$M$$ in the next $$M$$ rolls, with the final roll being $$N$$, is $$p_M^{\,} (1-p_M^{\,})^{M-1}p_N^{\,}$$

• For example with $$N=7$$ and summing over the other $$M$$ this is about $$0.07629468$$.
• The probability of ending up with $$N$$ is the sum of these last two i.e. initially rolling some other number (let's say $$M$$ but we will have to sum over these) then failing to hit $$M$$ in the next $$M$$ rolls, with the final roll being $$N$$ is $$p_N^{\,}\left(1-\left(1-p_N^{\,}\right)^N\right) +\sum\limits_{M\not = N}p_M^{\,} (1-p_M^{\,})^{M-1}p_N^{\,}$$

• For example with $$N=7$$ this is about $$0.12015306+0.07629468=0.19644774$$. The probability of this happening ten times in a row is about $$0.19644774^{10} \approx 0.0000000856$$

So in R the probabilities are (exact up to rounding)

pN <- function(N){
(6-abs(N-7))/36
}
M <- function(N){
(2:12)[(2:12) != N]
}
probrevealNafterN <- function(N){
pN(N) * (1 - (1-pN(N))^N)
}
probrevealNafternotN <- function(N){
sum(pN(M(N))*(1-pN(M(N)))^(M(N)-1))*pN(N)
}

probrevealN <- numeric(12)
for (N in 2:12){
probrevealN[N] <- probrevealNafterN(N) + probrevealNafternotN(N)
}
t(t(probrevealN))
#  [2,] 0.01503784
#  [3,] 0.03453384
#  [4,] 0.06194415
#  [5,] 0.09880993
#  [6,] 0.14445980
#  [7,] 0.19644774
#  [8,] 0.16145802
#  [9,] 0.12487112
# [10,] 0.08804986
# [11,] 0.05271967
# [12,] 0.02166803


looking like

barplot(probrevealN, names.arg=1:12)


much the same as CoveredInChocolate's simulation

I wrote an R-script that should simulate your experiment. I used 1 million die tosses. Hopefully I understood it correctly. I have included the code below.

Here is the histogram I got from the simulation. It is slightly skewed which makes sense. 6 and 8 occur with the same probability, but since we look through more tosses when $$N$$ is 8, it has a higher chance of making it into the sequence. The same is true for 9 vs. 5 and the other values.

As a check, here are the first 100 die tosses and the first 100 values added to the sequence.

I started by registering the 7th toss as the first $$N$$, which in this case was 9. After 9, there are no nines encountered within the next nine tosses, so the next value in the sequence becomes 3. No 3s until we get 11, and so on. We suddenly get a bunch of repeating 9s until the chain is broken with a 3.

If I misunderstood something in the experiment, it should be easy to see from this.

> dieToss[1:100]
[1]  8 10  8  9  7  7  9  7  7  5 11  8 10  4  4  3  5  6 11  8  7  8  4  5  9  6  9 12  5
[30]  9 10  8  4  3 10  7  9 11  7  9  9  9  4  8 11  9  9  3  8 11  8 11  9  5 12  7  3  5
[59]  7  2  9  8  8  7  8 11  4  5  7  3  9  6  4  7  6  8  8  9  4  9  9  6  5  4  4  8 10
[88]  7  5  2  9  9  5  9  7 10  9  8  5  7
> dieToss[7]
[1] 9
> Nseq[1:100]
[1]  9  3 11  9  9  9  9  9  9  9  9  9  3  4  8  4  5  5  8  8  8  8 10  8  8  8  8  7  7
[30]  7  7  7  7  7  7  7  7  7 10 10 10  8  8  8  8  8  8  8  7  4  4  6  6  7  7  7  7  5
[59]  5 12  9  9  7  7  7  7  7  7 12  9  9  9  4  7  7  7  7  8  3  9  9  9  9  7 10  6  6
[88]  9  4  2  5  5  7  7  7  7  7  7  7  7


I have also included my script if anyone is interested. Not going to pretend it is beautiful and efficient code. Quick and dirty is the way to go!

NSIM = 1000*1000

d1 = sample(1:6, size=NSIM, replace=TRUE)
d2 = sample(1:6, size=NSIM, replace=TRUE)

dieToss = d1 + d2

i = 1
Nseq = rep(0, NSIM)
N = 7

# Initializing first N
Nseq[i] = dieToss[N]
i = i + 1

# Counter to check if N appears within N tosses
counter = 0

while(N < NSIM) {
counter = counter + 1
N = N + 1
if (dieToss[N] == Nseq[i-1] & counter <  Nseq[i-1]) {
# Found N before N tosses
counter = 0
Nseq[i] = Nseq[i-1]
i = i + 1
} else if (counter == Nseq[i-1]) {
counter = 0
Nseq[i] = dieToss[N]
i = i + 1
}
}

dieToss[1:100]
dieToss[7]
Nseq[1:100]

# Only retaining non-zero Ns
NOUT = Nseq[Nseq != 0]

hist(NOUT)