login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A208902
The sum over all bitstrings b of length n of the number of runs in b not immediately followed by a longer run.
5
2, 6, 14, 34, 78, 182, 414, 942, 2110, 4702, 10366, 22718, 49406, 106878, 229886, 492286, 1049598, 2229758, 4720638, 9964542, 20975614, 44046334, 92282878, 192950270, 402669566, 838885374, 1744863230, 3623927806, 7516258302, 15569354750, 32212385790
OFFSET
1,1
COMMENTS
A run is a maximal subsequence of (possibly just one) identical bits.
LINKS
Aruna Gabhe, Problem 11623, Am. Math. Monthly 119 (2012) 161.
FORMULA
a(n) = 2^n * (2 + (n - 1)/2 - (1/2)^(n - 1) - 2 (1 - (1/2)^floor(n/2)) + (1/2)^(floor(n/2) + 1) (1 + (-1)^n)).
a(n) = A208903(n) + 2.
a(n) = 5*a(n-1) - 6*a(n-2) - 6*a(n-3) + 16*a(n-4) - 8*a(n-5), a(1) = 2, a(2) = 6, a(3) = 14, a(4) = 34, a(5) = 78.
G.f.: (2 - 4*x - 4*x^2 + 12*x^3 - 4*x^4)/(1 - 5*x + 6*x^2 + 6*x^3 - 16*x^4 + 8*x^5).
EXAMPLE
When n=3, 000,111 each have 1 such run, 101,010 each have 3, 100,011 each have 1, 001, 110 each have 2, summing these gives 2+6+2+4=14 so a(3) = 14.
MATHEMATICA
Table[2^n*(2 + (n - 1)/2 - (1/2)^(n - 1) - 2*(1 - (1/2)^Floor[n/2]) + (1/2)^(Floor[n/2] + 1) (1 + (-1)^n)), {n, 1, 40}]
LinearRecurrence[{5, -6, -6, 16, -8}, {2, 6, 14, 34, 78}, 40]
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
David Nacin, Mar 03 2012
STATUS
approved