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”).

A176354
The number of words of length n created with the letters a, b, c with at least as many a's as b's and at least as many b's as c's and no adjacent letters forming the pattern aba.
2
1, 1, 3, 9, 17, 46, 153, 338, 935, 3067, 7182, 20064, 64819, 156968, 441084, 1408612, 3488489, 9840608, 31145791, 78388512, 221722954, 696757333, 1775204952, 5031253931, 15718503073, 40435757688, 114779701466, 356852697226, 925209496348, 2629513384131
OFFSET
0,3
LINKS
MAPLE
a:= n-> add(add(w(na, nb, n-na-nb, 0),
nb=ceil((n-na)/2)..min(n-na, na)), na=ceil(n/3)..n):
w:= proc(a, b, c, x) option remember;
`if`([a, b, c]=[0$3], 1, `if`(a>0 and x<2, w(a-1, b, c, 1), 0)+
`if`(b>0, w(a, b-1, c, `if`(x=1, 2, 0)), 0)+
`if`(c>0, w(a, b, c-1, 0), 0))
end:
seq(a(n), n=0..40); # Alois P. Heinz, May 22 2012
MATHEMATICA
a[n_] := Sum[Sum[w[na, nb, n - na - nb, 0], {nb, Ceiling[(n - na)/2], Min[n - na, na]}], {na, Ceiling[n/3], n}];
w[a_, b_, c_, x_] := w[a, b, c, x] = If[{a, b, c} == {0, 0, 0}, 1, If[a > 0 && x < 2, w[a - 1, b, c, 1], 0] + If[b > 0, w[a, b - 1, c, If[x == 1, 2, 0]], 0] + If[c > 0, w[a, b, c - 1, 0], 0]];
a /@ Range[0, 40] (* Jean-François Alcover, Nov 11 2020, after Alois P. Heinz *)
PROG
(Sage)
def atleastcond(w):
return w.count(0) >= w.count(1) >= w.count(2)
def avoidsaba(w):
for i in range(len(w)-2):
if w[i] == 0 and w[i+1] == 1 and w[i+2] == 0:
return False
return True
len([w for w in Words([0, 1, 2], length=6) if atleastcond(w) and avoidsaba(w)])
# Jenny Li (jiemi2007(AT)yahoo.ca), Apr 17 2010
CROSSREFS
Sequence in context: A348382 A176148 A206701 * A210337 A173140 A018307
KEYWORD
nonn
AUTHOR
Jenny Li (jiemi2007(AT)yahoo.ca), Apr 15 2010, Apr 17 2010
EXTENSIONS
Extended beyond a(15) by Alois P. Heinz, May 22 2012
STATUS
approved