<s>[INST] Die that never rolls the same number consecutively Suppose we have a "magic" die $[1-6]$ that never rolls the same number consecutively.
That means you will never find the same number repeated in a row.
Now let's suppose that we roll this die $1000$ times.
How can I find the PDF, expected number of times and variance of getting a specific value?
 [/INST] let $P_{k,n}$ be the probability to get $k$ times the result "1" in $n$ throws, and let $$P_{k,n} = p_{k,n} + q_{k,n}$$ where $p,q$ are the corresponding probabilities where you add the constraint that you finish with a 1 (for $p$) or anything but 1 (for $q$).
It is easy to get the equations (for $n \ge 1$) : 
 $$5p_{k,n} = q_{k-1,n-1}$$ and $$5q_{k,n} = 5p_{k,n-1} + 4 q_{k,n-1}$$
from which you get that for $n \ge 2$, $$5q_{k,n} = q_{k-1,n-2} + 4q_{k,n-1}$$
Obviously, the $(p_{k,n})$ family satisfies the same linear equation, and since $P$ is the sum of $p$ and $q$, we have for $n \ge2$, that $$5P_{k,n} = P_{k-1,n-2} + 4P_{k,n-1}$$
Together with the data that $P_{0,0} = 1, P_{0,1} = \frac 16, P_{1,1} = \frac 56$ this is enough to determine all those numbers.
Let $f(x,y)$ be the formal power series $$f(x,y)=\sum P_{k,n} x^k y^n$$ From the recurrence on $P$ we immediately have that in $(5-4y-xy^2)f(x,y)$, every coefficient vanish except the coefficients of $x^0y^0, x^0y^1, x^1y^1$, and so that $f(x,y)$ is the power series of the rational fraction $$\frac {30+y+5xy}{6(5-4y-xyy)}$$
We can check that doing the partial evaluation $x=1$ we get $$f(1,y) = \frac {30+6y}{6(5-4y-yy)} = \frac{6(5+y)}{6(5+y)(1-y)} = \frac 1 {1-y} = 1 + y + y^2 + \dots$$so for each $n$, all the probabilities $P_{k,n}$ sum to $1$.

If $E_n$ is the expectation of the number of occurences of 1 in $n$ throws then $$E_n = \sum k P_{k,n}$$so that $$\sum E_n y^n = \frac {df}{dx} (1,y)$$
We compute
$$\frac{ df}{dx} = \frac  {(5y)(5-4y-xyy)-(-yy)(30+y+5xy)}{6(5-4y-xyy)^2}
 = \frac {y(5+y)^2}{6(5-4y-xyy)^2}$$
Then evaluating this at $x=1$ we get $$\sum E_ny^n = \frac {y(5+y)^2}{6(5+y)^2(1-y)^2} = \frac y {6(1-y)^2} = \sum \frac n6 y^n$$
Thus $E_n = n/6$ which is as we expected.

To compute the variance we need to compute the expectancy of the square of the number of occurences,
that is, $F_n = \sum k^2 P_{k,n}$.
Then $$\sum F_n y^n = \frac {d^2f}{dx^2}(1,y) + \frac {df}{dx}(1,y) = 
\frac{2y^3(5+y)^2}{6(5+y)^3(1-y)^3} + \frac y{6(1-y)^2} = \frac{2y^3+y(5+y)(1-y)}{6(5+y)(1-y)^3} = \frac{5y-4y^2+y^3}{6(5+y)(1-y)^3}$$
$$\sum E_n^2 y^n = \sum \frac 1{36} n^2y^n = \frac {y(1+y)}{36(1-y)^3}$$
Computing their difference gives the variance :
$$\sum V_n y^n = \frac {30y-24y^2+6y^3-y(1+y)(5+y)} {36(5+y)(1-y)^3}
 = \frac {5y(5-6y+y^2)}{36(5+y)(1-y)^3}
 = \frac {5y(5-y)}{36(5+y)(1-y)^2} \sim_{y=1} \frac {20}{216(1-y)^2}$$
Doing the partial fraction decomposition gives a formula $$V_n = \frac {50}{1296} + \frac{20}{216}n - \frac {50}{1296}(-1/5)^n$$

I expect that after renormalization, your random variable (number of 1s obtained in $n$ throws) converges in law to a gaussian variable as $n \to \infty$.
</s>