OFFSET
1,4
LINKS
Andrew Howroyd, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (4,-6,4,1,-4,2,0,-1).
FORMULA
a(n) = Sum_{i=1..floor((n+1)/4)} i*binomial(n+1-2*i,2*i).
G.f.: x^3*(1 - x)/((1 - x + x^2)^2*(1 - x - x^2)^2).
EXAMPLE
a(6) = 10 counts the number of runs of 1's in {000111, 001110, 011100, 111000, 001111, 011110, 111100, 011111, 111110, 111111}.
a(7) = 17 counts 15 words with one run of 1's and 1110111 has two runs of 1's.
PROG
(PARI) my(N=40); Vec(x^3*(1 - x)/((1 - x + x^2)^2*(1 - x - x^2)^2) + O(x*x^N), -N)
(PARI) a(n) = sum(i=1, (n+1)\4, i*binomial(n+1-2*i, 2*i))
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Andrew Howroyd, Oct 05 2025
STATUS
approved
