Probability of Random Integers in a series of ascending/descending Runs

42 Views Asked by At

Suppose you have a set of $N$ random integers. Each integer is limited to the range from $0$ to $99$.

You then consider each subsequent neighbor as "ascending" or "descending", counting the number of consecutive neighbors who are also of the same kind. ( i.e. $1234$ is a "run" of $3$ ascending neighbors; $123431$ is a ascending run of $3$ followed by a descending run of $2$ ). As an assumption, the problem considers both ascending and descending to be functionally symmetrical/same. We can only consider runs of one direction.

In the set of $N$ members, what is the probability of any Run of length $L$?

i.e. In the set of $N$, how many runs of length $1$ should there be? Is there a formula for Runs-of-Length given $N$ and the range of values of the integers?

I feel that there should be a "simple" formula/algorithm, but I cannot figure it out and I have not found any similar information with searches.

An EXAMPLE data set, a specific series generated the following "rising" runs.

$N$ = $67108864$

[Length]=   num of occurs
[0]=    0
[1]=    13926757
[2]=    6144339
[3]=    1779212
[4]=    391946
[5]=    71071
[6]=    10716
[7]=    1390
[8]=    164
[9]=    16
[10]=   3
[11]=   0
[12]=   0

Total number of Runs = $22325614$

As you can see, the distribution appears to be some sort of bell perhaps. However, I am unable to figure out what kind and what the PDF is. All series I generate from various "random" sources seem to yield similar results, but not exact ( of course ).

Thanks in advance!