A186244
Number of ternary strings of length n containing 00.
Original entry on oeis.org
0, 0, 1, 5, 21, 79, 281, 963, 3217, 10547, 34089, 108955, 345137, 1085331, 3392377, 10549739, 32667201, 100782787, 309946697, 950599131, 2908512145, 8880484019, 27064776729, 82350874699, 250212362465, 759269653155, 2301393567721, 6968615051195
Offset: 0
-
t = {0, 0, 1}; Do[AppendTo[t, 3 t[[-1]] + 2*(3^(n - 3) - t[[-3]])], {n, 3, 40}]; t (* T. D. Noe, Nov 11 2013 *)
CoefficientList[Series[x^2/(3*x - 1)/(2*x^2 + 2*x - 1), {x,0,50}], x] (* G. C. Greubel, Feb 19 2017 *)
-
x='x+O('x^50); Vec(x^2/(3*x - 1)/(2*x^2 + 2*x - 1)) \\ G. C. Greubel, Feb 19 2017
-
a(n)=3^n - ([1, 3; 1, 1]^n*[2; 1])[2, 1] \\ Charles R Greathouse IV, Feb 19 2017
A338230
Number of ternary strings of length n that contain at least two 0's and at most one 1.
Original entry on oeis.org
0, 0, 1, 7, 27, 81, 213, 519, 1207, 2725, 6033, 13179, 28515, 61257, 130861, 278287, 589551, 1244877, 2621097, 5504643, 11533915, 24116785, 50331141, 104857047, 218103207, 452984181, 939523393, 1946156299, 4026531027, 8321498265, 17179868253, 35433479199, 73014442975, 150323854237
Offset: 0
a(4) = 27 since the strings consist of 0000, the 4 permutations of 0001, the 4 permutations of 0002, the 6 permutations of 0022, and the 12 permutations of 0012. The total number of strings is then 1 + 4 + 4 + 6 + 12 = 27.
-
CoefficientList[Series[Exp[x](Exp[x]-1-x)(1+x),{x,0,32}],x]Table[i!,{i,0,32}] (* Stefano Spezia, Jan 31 2021 *)
A141688
Triangle T(n, k) = Fibonacci(2*k)*T(n-1, k) + Fibonacci(2*(n-k+1))*T(n-1, k-1), with T(n, 1) = T(n, n) = 1, read by rows.
Original entry on oeis.org
1, 1, 1, 1, 6, 1, 1, 26, 26, 1, 1, 99, 416, 99, 1, 1, 352, 5407, 5407, 352, 1, 1, 1200, 62616, 227094, 62616, 1200, 1, 1, 3977, 673728, 8212854, 8212854, 673728, 3977, 1, 1, 12918, 6889153, 269486766, 903413940, 269486766, 6889153, 12918, 1, 1, 41338, 67863290, 8256432767, 88493861004, 88493861004, 8256432767, 67863290, 41338, 1
Offset: 1
Triangle begins as:
1;
1, 1;
1, 6, 1;
1, 26, 26, 1;
1, 99, 416, 99, 1;
1, 352, 5407, 5407, 352, 1;
1, 1200, 62616, 227094, 62616, 1200, 1;
1, 3977, 673728, 8212854, 8212854, 673728, 3977, 1;
1, 12918, 6889153, 269486766, 903413940,269486766, 6889153, 12918, 1;
-
function T(n,k)
if k eq 1 or k eq n then return 1;
else return Fibonacci(2*(n-k+1))*T(n-1, k-1) + Fibonacci(2*k)*T(n-1, k);
end if; return T;
end function;
[T(n,k): k in [1..n], n in [1..12]]; // G. C. Greubel, Mar 29 2021
-
(* First program *)
b[n_]:= b[n]= If[n==0, 1, Sum[k*b[n-k], {k,n}]];
T[n_, k_]:= If[k==1 || k==n, 1, b[n-k+1]*T[n-1, k-1] + b[k]*T[n-1, k]];
Table[T[n, k], {n,12}, {k,n}]//Flatten (* modified by G. C. Greubel, Mar 29 2021 *)
(* Second program *)
T[n_, k_]:= T[n, k]= If[k==1 || k==n, 1, Fibonacci[2*(n-k+1)]*T[n-1, k-1] + Fibonacci[2*k]*T[n-1, k]];
Table[T[n, k], {n, 12}, {k, n}]//Flatten (* G. C. Greubel, Mar 29 2021 *)
-
@CachedFunction
def T(n,k): return 1 if (k==1 or k==n) else fibonacci(2*(n-k+1))*T(n-1, k-1) + fibonacci(2*k)*T(n-1, k)
flatten([[T(n,k) for k in (1..n)] for n in (1..12)]) # G. C. Greubel, Mar 29 2021
A215595
Number of strings of length n, formed from the 26-letter English alphabet, which contain the substring xy.
Original entry on oeis.org
0, 0, 1, 52, 2027, 70226, 2280825, 71112600, 2155562551, 64005323902, 1870809923477, 54006556365476, 1543466751232275, 43746473462661450, 1231293799939647601, 34451045198171912752, 959005856055827234927, 26576960554539062120726, 733650711461388661963725
Offset: 0
For n = 2, the only such string is xy. For n = 3, there are 26 strings of the form *xy and 26 of the form xy*. For n = 4, there are 26^2 of each of the forms xy**, *xy* and **xy, but we double count xyxy, so the answer for n=4 is 3*26^2 - 1 = 2027.
Cf.
A186314 (same problem for ternary strings).
-
Join[{0}, CoefficientList[Series[x/(1 - 52*x + 677*x^2 - 26*x^3), {x, 0, 50}], x]] (* G. C. Greubel, Feb 26 2017 *)
-
x='x+O('x^50); concat([0,0], Vec(x/(1 - 52*x + 677*x^2 - 26*x^3))) \\ G. C. Greubel, Feb 26 2017
A309000
Number of strings of length n from a 3-symbol alphabet (A,B,C, say) containing at least one "A" and at least two "B"s.
Original entry on oeis.org
3, 22, 105, 416, 1491, 5034, 16365, 51892, 161799, 498686, 1524705, 4635528, 14037627, 42391378, 127763925, 384536924, 1156232175, 3474201510, 10434138825, 31326533680, 94029932643, 282194655482, 846802070205, 2540859195396, 7623517110231, 22872497487694
Offset: 3
Suppose three-sided dice each have sides labeled A,B,C.
If there are three dice, then ABB, BAB, and BBA are the three strings resulting from rolling the dice satisfying the property of at least one A and at least two B's, hence a(3)=3 [Note a(0)=a(1)=a(2)=0].
If there are four such dice, there are 22 such permutations, hence a(4)=22: AABB, ABAB, ABBA, ABBB, ABBC, ABCB, ACBB, BAAB, BABA, BABB, BABC, BACB, BBAA, BBAB, BBAC, BBBA, BBCA, BCAB, BCBA, CABB, CBAB, CBBA.
-
[3^n-2^(n+1)-n*2^(n-1)+n+1: n in [3..40]]; // Vincenzo Librandi, Jul 05 2019
-
Array[3^# - 2^(# + 1) - # 2^(# - 1) + # + 1 &, 27, 3] (* or *)
CoefficientList[Series[(-3 + 5 x)/((-1 + 3 x) (1 - 3 x + 2 x^2)^2), {x, 0, 26}], x] (* Michael De Vlieger, Jul 04 2019 *)
-
[3**n-2**(n+1)-n*2**(n-1)+n+1 for n in range(3,20)]
Showing 1-5 of 5 results.
Comments