login
a(n) = binomial(n,2)*(2^(n-2) - n + 1).
0

%I #18 May 14 2022 14:11:32

%S 0,0,0,0,6,40,165,546,1596,4320,11115,27610,66858,158808,371553,

%T 858690,1964280,4454272,10024407,22410234,49803750,110096280,

%U 242216205,530573890,1157621556,2516575200,5452587075,11777596506,25367140386,54492386200,116769410745

%N a(n) = binomial(n,2)*(2^(n-2) - n + 1).

%C a(n) is the number of ternary strings of length n with two 1's and at least two 0's.

%C Note the number of binary strings of length n with two 1's and at least two 0's is counted by a(n)=0, n < 4; a(n) = binomial(n,2), n >= 4 (e.g.f: (exp(x)-x-1)*x^2/2).

%H <a href="/index/Rec#order_07">Index entries for linear recurrences with constant coefficients</a>, signature (10,-42,96,-129,102,-44,8).

%F E.g.f: exp(x)*(exp(x)-x-1)*x^2/2.

%F G.f.: x^4*(6 - 20*x + 17*x^2)/((1 - x)^4*(1 - 2*x)^3). - _Stefano Spezia_, Mar 12 2021

%e a(6)=165 since the strings are the 15 permutations of 110000, the 60 permutations of 110002, and the 90 permutations of 110022.

%t a[n_]:=Binomial[n,2]*(2^(n-2)-n+1)

%t Array[a,30,0] (* _Giorgos Kalogeropoulos_, Mar 31 2021 *)

%t LinearRecurrence[{10,-42,96,-129,102,-44,8},{0,0,0,0,6,40,165},50] (* _Harvey P. Dale_, May 14 2022 *)

%K nonn,easy

%O 0,5

%A _Enrique Navarrete_, Mar 10 2021