A209241 3^n times the expected value of the longest run of 0's in all length n words on {0,1,2}.
0, 1, 6, 25, 92, 317, 1054, 3425, 10964, 34729, 109162, 341125, 1061132, 3288713, 10161666, 31318201, 96312696, 295632805, 905955146, 2772234385, 8472129040, 25861509393, 78861419302, 240252829461, 731313754312, 2224352781697
Offset: 0
Keywords
Examples
a(2) = 6 because for such length 2 words: 00, 01, 02, 10, 11, 12, 20, 21, 22 we have respectively longest zero runs of length 2 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 = 6.
References
- R. Sedgewick and P. Flajolet, Analysis of Algorithms, Addison and Wesley, 1996, Chapter 7.
Links
- G. C. Greubel, Table of n, a(n) for n = 0..1000
Crossrefs
Cf. A119706.
Programs
-
Mathematica
nn=25; CoefficientList[Series[Sum[1/(1-3x)-(1-x^k)/(1-3x+2x^(k+1)), {k,1,nn}], {x,0,nn}], x]
Formula
O.g.f.: Sum_{k=1..n} 1/(1-3x)-(1-x^k)/(1-3x+2x^(k+1)).
a(n) = Sum_{k=1..n} A209240(n,k)*k.
Comments