How likely is it that in five randomly-generated single-digit numbers there will be three of the same in a row? A random number generator creates five single-digit numbers. It produces the numbers 7, 5, 2, 2, 2.
How likely is it that in any set of five randomly generated single-digit numbers (0-9) there will be three or more identical ones? How likely is it that there will be three or more in a row?
 A: There are $10^5$ equally likely strings of length $5$. We count the favourables, for the two problems.
First problem: The "special" number can be chosen in $\binom{10}{1}$ ways. We count the number of patterns with $3$ or more $7$'s, and multiply the result by $\binom{10}{1}$. 
Three $7$'s: They can be placed in $\binom{5}{3}$ ways, and the remaining slots can be filled in $9^2$ ways.
Four $7$'s: They can be placed in $\binom{5}{4}$ ways, and the remaining slot can be filled in $9^1$ ways.
Five $7$'s: They can be placed in $\binom{5}{5}$ ways, and the "rest" can be filled in $9^0$ ways. Of course, that's just a fancy way of saying there is only one way to have five $7$'s, but for symmetry the more convoluted form is useful. 
Putting things together, we find that the required probability is
$$\frac{\binom{10}{1}\left[\binom{5}{3}9^2+\binom{5}{4}9^1+\binom{5}{5}9^0   \right]}{10^5}.$$
Second problem: The basic strategy is the same, the count details slightly different. 
A: For the second problem I come to: $$10\times P\left(A_{3,5}\right)=10\times10^{-3}\left(1+\left(5-3\right)\frac{9}{10}\right)=28\times10^{-3}$$
This on base of this question that was once asked by myself.
Also have a look at this question.
A: I only consider the second part, for three of more in a row:
First the answer as computed by Mathematica:
In[1]:= Probability[
 x1 == x2 == x3 || x2 == x3 == x4 || x3 == x4 == x5, 
 Distributed[{x1, x2, x3, x4, x5}, 
  ProductDistribution[{DiscreteUniformDistribution[{0, 9}], 5}]]]

Out[1]= 7/250

To recover it, note that there is exactly $N_5 = 10$ configurations of 5 same digits in a row, and $N_4 = 2 \cdot 10 \cdot 9$ of configurations of exactly 4 digits in a row (2 because of two possible patterns $\underline{}dddd$ or $dddd\underline{}$). For exactly three in the row, consider patters $abddd$ and $dddba$. There are equal number of these patterns. $a$ can assume any of 10 possible values, while $b$ needs to be distinct from $d$, hence these patterns contribute $2 \cdot N_a \cdot N_b \cdot N_c = 2 \cdot 10 \cdot 9 \cdot 10$, while the pattern $adddb$ contributes $9^2 \cdot 10$, hence there 
$$
    N_3 = 2 \cdot 10^2 \cdot 9 + 10 \cdot 9^2 = 2610
$$
Hence
$$
   N_I = N_5 + N_4 + N_3 = 10 + 180 + 2610 = 2800
$$
Therefore the probability equals
$$
   p = \frac{N_I}{N_T} = \frac{2800}{10^5} = \frac{7}{250}
$$
