OFFSET
0,3
COMMENTS
A bitstring is solus if all of its 1's are isolated.
The number of these bitstrings is A000045(n+2).
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
Steven Finch, Cantor-solus and Cantor-multus distributions, arXiv:2003.09458 [math.CO], 2020.
FORMULA
G.f.: Sum_{k>=1} (1+x)/(1-x-x^2)-(1+x-x^k-x^(k+1))/(1-x-x^2+x^(k+1)).
EXAMPLE
a(4) = 18 because the A000045(6) = 8 solus bitstrings of length 4 are 0000, 1000, 0100, 0010, 0001, 1010, 0101, 1001 and the longest 0-runs contribute 4+3+2+2+3+1+1+2 = 18.
MAPLE
b:= proc(n, w, m, s) option remember; `if`(n=0, m,
b(n-1, w+1, max(m, w+1), irem(s, 10)*10+0)+
`if`(s in [01, 21], 0, b(n-1, 0, m, irem(s, 10)*10+1)))
end:
a:= n-> b(n, 0, 0, 22):
seq(a(n), n=0..39); # Alois P. Heinz, Mar 18 2020
MATHEMATICA
b[n_, w_, m_, s_] := b[n, w, m, s] = If[n == 0, m, b[n-1, w+1, Max[m, w+1], Mod[s, 10]*10+0]+If[MatchQ[s, 01|21], 0, b[n-1, 0, m, Mod[s, 10]*10+1]]];
a[n_] := b[n, 0, 0, 22];
a /@ Range[0, 39] (* Jean-François Alcover, Aug 21 2020, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Steven Finch, Mar 18 2020
STATUS
approved