cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-2 of 2 results.

A338232 Number of ternary strings of length n that contain at least two 0's and at most two 1's.

Original entry on oeis.org

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
Offset: 0

Views

Author

Enrique Navarrete, Jan 30 2021

Keywords

Examples

			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.
		

Crossrefs

Programs

  • 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 *)
    LinearRecurrence[{10,-42,96,-129,102,-44,8},{0,0,1,7,33,121,378},40] (* Harvey P. Dale, Jan 31 2025 *)

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

A338229 Number of ternary strings of length n that contain at least one 0 and at most two 1's.

Original entry on oeis.org

0, 1, 5, 19, 61, 176, 474, 1219, 3035, 7378, 17608, 41405, 96177, 221092, 503702, 1138567, 2555767, 5701478, 12648276, 27918145, 61341485, 134217496, 292552450, 635436779, 1375731411, 2969566906, 6392118944, 13723762309, 29393682025, 62813896268, 133949292078, 285078453775, 605590388207
Offset: 0

Views

Author

Enrique Navarrete, Jan 30 2021

Keywords

Examples

			a(3) = 19 since the strings are composed of 000, the 6 permutations of 012, and the 3 permutations of 001, 002, 011 and 022. The total number of strings is then 1 + 6 + 3 + 3 + 3 + 3 = 19.
		

Crossrefs

Programs

  • Mathematica
    CoefficientList[Series[Exp[x](Exp[x]-1)(2+2x+x^2)/2,{x,0,32}],x]Table[i!,{i,0,32}] (* Stefano Spezia, Jan 31 2021 *)
    LinearRecurrence[{9,-33,63,-66,36,-8},{0,1,5,19,61,176},40] (* Harvey P. Dale, Mar 23 2022 *)

Formula

a(n) = 2^n + n*2^(n-1) + binomial(n,2)*2^(n-2) - binomial(n,2) - n - 1.
E.g.f.: exp(x)*(exp(x) - 1)*(2 + 2*x + x^2)/2.
G.f.: x*(1 - 4*x + 7*x^2 - 8*x^3 + 5*x^4)/(1 - 3*x + 2*x^2)^3. - Stefano Spezia, Jan 31 2021
Showing 1-2 of 2 results.