Is there a generalized formula for finding the probability of a number sequence occurring in an ordered set of random numbers?
Let me clarify:
Let's suppose set $S$ with $n$ elements. All of the elements are integers between 0 and 9. Now we want to find the probability of some number sequence of length l $(1\leq l \leq n)$ occurring in its exact order in $S$ at least once. (Both the sequence and $S$ are ordered)
Some simple examples:
If $n = 1$ and the wanted "sequence" is just a single digit (let's say 7), then the probability of it occurring would be $\frac{1}{10}$. If $n = 2$ however, it's possible for the 7 to occur as the first, second or both entries. Therefore the probability would be $\frac{1}{10}*\frac{9}{10} + \frac{9}{10}*\frac{1}{10} + (\frac{1}{10})^2 = \frac{19}{100}$
Needless to say, these formulas would quickly get very long. But is there a general formula which accounts for $n, l$ and chance of a single element matching (in my example with single digits it would be $\frac{1}{10}$)