login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

LINKS

Alois P. Heinz, Table of n, a(n) for n = 0..200

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

Cf. A176148, A206701.

Sequence in context: A128301 A176148 A206701 * A210337 A173140 A018307

Adjacent sequences:  A176351 A176352 A176353 * A176355 A176356 A176357

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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified October 22 22:35 EDT 2021. Contains 348180 sequences. (Running on oeis4.)