login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A338232 Number of ternary strings of length n that contain at least two 0's and at most two 1's. 2
0, 0, 1, 7, 33, 121, 378, 1065, 2803, 7045, 17148, 40789, 95373, 220065, 502414, 1136977, 2553831, 5699149, 12645504, 27914877, 61337665, 134213065, 292547346, 635430937, 1375724763, 2969559381, 6392110468, 13723752805, 29393671413, 62813884465, 133949278998, 285078439329, 605590372303 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
LINKS
FORMULA
a(n) = 2^n + n*2^(n-1) + binomial(n,2)*2^(n-2) - 3*binomial(n,2) - 3*binomial(n,3) - 2*n - 1.
E.g.f.: exp(x)*(exp(x) - 1 - x)*(2 + 2*x + x^2)/2.
G.f.: x^2*(1-3*x+5*x^2-11*x^3+11*x^4)/((1-x)^4*(1-2*x)^3). - Stefano Spezia, Jan 31 2021
EXAMPLE
a(4) = 33 since the strings are composed of 0000, the 4 permutations of 0001, the 4 permutations of 0002, the 6 permutations of 0011, the 6 permutations of 0022, and the 12 permutations of 0012. Thus, the total number of strings is 1 + 4 + 4 + 6 + 6 + 12 = 33.
MATHEMATICA
CoefficientList[Series[Exp[x](Exp[x]-1-x)(2+2x+x^2)/2, {x, 0, 32}], x]Table[i!, {i, 0, 32}] (* Stefano Spezia, Jan 31 2021 *)
CROSSREFS
Sequence in context: A100855 A256860 A221036 * A000605 A215054 A350643
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Jan 30 2021
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 04:42 EDT 2024. Contains 371964 sequences. (Running on oeis4.)