What is the probability of rolling a 6-sided die 5 times, and getting at least 3 in a row? I had been working on this problem, and ran into trouble because I couldn't easily use the "find the opposite probability and subtract from one" trick. So for example I think I can find the probability of getting at least two in a row rolling a die 5 times, by finding the probability of getting no duplicates at all and then subtracting from one to find the opposite: ( 1 - (5/6)^4 )
But how to find the probability of a sequence of at least three? The extension of the problem is to write a formula generalizable to the number of trials, number of possible outcomes per trial, and the length of the repeated sequence. 
I like working on this on my own so if you can just give a little hint or guidance I'd appreciate it very much!
 A: You can do this using inclusion-exclusion. The conditions you want are the three conditions that the first, second or third triple of rolls are all the same. Adding the three counts for each of these conditions being met is straightforward. Then you need to substract the counts for each pair of conditions being met. This is only slightly more involved; you need to take into account that in one case the pair covers all five rolls and in the other two cases it only covers four rolls. Then you need to add the count for all three conditions being met – this is again straightforward.
A: (The following does not lead to an immediate generalization.)
Write $T$ for the number appearing $\geq3$ times in a row, $X$ for any number in $[6]\setminus\{T\}$, and $N$ for any number in $[6]$. Then the successful sixtuples are of the form
$$T^3XN, \quad X T^3X, \quad NXT^3;\quad T^4X, \quad XT^4;\quad T^5\ .$$
As $T$ can be selected in $6$ ways, $X$ in $5$ ways, and $N$ in $6$ ways we obtain a total of
$$6\cdot 5\cdot 6+5\cdot 6\cdot 5+6\cdot 5\cdot 6+6\cdot 5+5\cdot 6+6=576$$
favorable cases, all of them equiprobable. The probability $P$ of a success is therefore given by 
$$P={576\over 6^5}={2\over27}\ .$$
A: The probability of getting exactly 3 in a row is obtained by counting the ways to select a number for those three, two numbers for the others (from the remaining five numbers, duplicates allowed) and choosing the start position for the triple, out of the total ways to roll the dice.$$\frac{6\cdot 4^2\cdot 3}{6^5} = \frac{4^2\cdot 3}{6^4} = \frac{25}{423}$$
Then to obtain the probability of at least three in a row, we also consider exactly 4 in a row, and all the same.$$\frac{5^2\cdot 3+5\cdot 2+1}{6^4} = \frac{43}{648}$$ 
