A386674 Indices of ascending runs in a random sequence in order of decreasing expected length.
5, 4, 6, 10, 11, 15, 16, 17, 21, 22, 20, 26, 27, 31, 32, 33, 37, 38, 36, 42, 43, 47, 48, 49, 53, 52, 54, 58, 59, 63, 64, 65, 69, 68, 70, 74, 75, 79, 80, 81, 85, 84, 86, 90, 91, 95, 96, 97, 101, 100, 102, 106, 107, 111, 112, 113, 117, 116, 118, 122, 123, 127
Offset: 1
Keywords
Examples
max{L(k) : k>=1} = L(5) = e^5 - 5*e^4 + 15/2*e^3 - 10/3*e^2 +5/24*e, so the fifth run (surprisingly) has longest expected length and a(1) = 5.
References
- Donald E. Knuth. The Art of Computer Programming. Vol. 3: Sorting and Searching. Addison-Wesley, second edition, 1998, pages 39-42,45,603.
Links
- David Bevan, Table of n, a(n) for n = 1..999
- Betty Jane Gassner, Sorting by replacement selecting, Commun. ACM, 10(2):89-93, 1967.
- William W. Hooker, On the expected lengths of sequences generated in sorting by replacement selecting, Commun. ACM, 12(7):411-413, 1969.
Crossrefs
The natural numbers are partitioned between this sequence and A386673.
Programs
-
Mathematica
eLen[1]=N[E-1];eLen[k_]:=N[k Sum[(-1)^j(k-j)^(j-1)/j!E^(k-j),{j,0,k-1}],k+10];decList[n_]:=First/@Take[Reverse@SortBy[Table[{k,eLen[k]},{k,2n+8}],Last],n];decList@20
Formula
If k>=2, then the expected length of the k-th ascending run is L(k) = k * Sum_{j=0..k-1} (-1)^j*(k-j)^(j-1)*exp(k-j)/j!. The expected length of the first run is L(1) = e-1.
The o.g.f. for L(k) is z*(1-z)/(exp(z-1)-z)-z.
Limit_{k->oo} L(k) = 2.
If z ~ 3.088843 + 7.461489i satisfies z=exp(z-1), then asymptotically L(k)-2 ~ 2*r^-k*cos(k*t), where r = |z| ~ 8.075566, and t = arg(z) ~ 1.178304 ~ Pi/2.666199.
Comments