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}$)

  • 2
    the first n digits of pi are not "random". They're the first n digits of pi. – Adam Rubinson Jan 17 '21 at 17:14
  • 3
    As for randomness and $\pi$, you seem to be alluding to the **unproven** conjecture that $\pi$ is a "*normal number.*" [See here](https://math.stackexchange.com/questions/216343/does-pi-contain-all-possible-number-combinations?noredirect=1&lq=1). – JMoravitz Jan 17 '21 at 17:15
  • 1
    Forget about pi for now and just think about a random sequence of $N$ positive integers. Count how many subsequences of length $n$ there are. – K.defaoite Jan 17 '21 at 17:16
  • @ChrisEckert You need to delete the reference to the digits of pi from the title and from the body of the question. – almagest Jan 17 '21 at 17:33
  • Of course I know that the digits of pi aren't random, but if you take the first n digits of pi, you get a set of numbers that seems random because all digits occur approximately with the same frequency and there is no pattern in the sequence. But I will delete the references to pi in case that helps to avoid confusion.. Still, the question is the same – Chris Eckert Jan 17 '21 at 17:40
  • @K.defaoite well I guess if the random sequence is of length $N$ and the subsequences are of length $n$ than that would make $N - n + 1$ subsequences. But how would that number help me in finding a general formula? – Chris Eckert Jan 17 '21 at 17:51

0 Answers0