login
This site is supported by donations to The OEIS Foundation.

 

Logo

Annual Appeal: Please make a donation (tax deductible in USA) to keep the OEIS running. Over 5000 articles have referenced us, often saying "we discovered this result with the help of the OEIS".

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A176433 The number of words of length n created with letters a, b, and 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 and no subwords (any adjacent or non adjacent subsequence of letters) of the form abc. 1
1, 1, 3, 8, 15, 35, 96, 186, 419, 1035, 2021, 4353, 10171, 19721, 41466, 93118, 180018, 371539, 813425, 1566398, 3194133, 6859558, 13179004, 26617619, 56371355, 108060479, 216736146, 453947049, 868857655, 1732792511, 3598157885, 6877348410, 13655273038 (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, 0),

        nb=ceil((n-na)/2)..min(n-na, na)), na=ceil(n/3)..n):

w:= proc(a, b, c, x, y) option remember;

      `if`([a, b, c]=[0$3], 1,

      `if`(a>0 and x<2 and y<2, w(a-1, b, c, 1, y), 0)+

      `if`(b>0, w(a, b-1, c, `if`(x=1, 2, 0), `if`(y>0, 2, 0)), 0)+

      `if`(c>0, w(a, b, c-1, 0, `if`(y=0, 1, y)), 0))

    end:

seq (a(n), n=0..40);  # Alois P. Heinz, May 22 2012

PROG

(C#) private static void GenerateCombo(string currentWord, int maxLength, ICollection<string> currentStrings) { if (currentWord.Length < maxLength) { GenerateCombo(currentWord+"a", maxLength, currentStrings); GenerateCombo(currentWord+"b", maxLength, currentStrings); GenerateCombo(currentWord+"c", maxLength, currentStrings); } else { if (Regex.IsMatch(currentWord, "aba")) return; if (Regex.IsMatch(currentWord, "[abc]*a[abc]*b[abc]*c[abc]*")) return; int aCount = CountOccurences('a', currentWord); int bCount = CountOccurences('b', currentWord); int cCount = CountOccurences('c', currentWord); if(cCount > bCount) return; if(bCount > aCount) return; currentStrings.Add(currentWord); } } private static int CountOccurences(char ch, string word) { int rez = 0; for(int i = 0 ; i < word.Length; i ++) if (word == ch) rez++; return rez; }

CROSSREFS

Sequence in context: A032234 A032255 A137475 * A132810 A032159 A174982

Adjacent sequences:  A176430 A176431 A176432 * A176434 A176435 A176436

KEYWORD

nonn

AUTHOR

Patrick McQuade (patrick.mcquade(AT)peelsb.com), Apr 17 2010

EXTENSIONS

More terms from 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 | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified December 3 01:12 EST 2016. Contains 278694 sequences.