A379836 Number of pairs of adjacent equal parts in all complete compositions of n.
0, 0, 1, 2, 5, 12, 23, 54, 118, 258, 550, 1178, 2540, 5394, 11473, 24174, 51021, 107210, 225099, 471322, 985202, 2055542, 4281847, 8906676, 18500425, 38379246, 79516158, 164561560, 340179441, 702506576, 1449311429, 2987297778, 6151964642, 12658841766, 26027603925
Offset: 0
Keywords
Examples
The complete compositions of n = 4 are: (1,1,2), (1,2,1), (2,1,1), and (1,1,1,1); having a total of 5 pairs of equal adjacent parts giving a(4) = 5.
Programs
-
PARI
C_xz(s,N) = {my(x='x+O('x^N), g=if(#s <1,1, sum(i=1,#s, C_xz(s[^i],N+1) * x^(s[i])/(1-(x^(s[i]))*(z-1)) )/(1-sum(i=1,#s, x^(s[i])/(1-(x^(s[i]))*(z-1)))))); return(g)} B_xz(N) = {my(x='x+O('x^N), j=1, h=0); while((j*(j+1))/2 <= N, h += C_xz(vector(j, i, i), N+1); j+=1); h} P_xz(N) = Pol(B_xz(N), {x}) B_x(N) = {my(cx = deriv(P_xz(N),z), z=1); Vecrev(eval(cx))} B_x(20)
Formula
G.f.: B(x) = d/dz Sum_{k>0} C({1..k},x,z)|{z=1} where C({s},x,z) = Sum{i in {s}} ( C({s}-{i},x,z)*(x^i)/(1-(x^i)*(z-1)) )/(1 - Sum_{i in {s}} (x^i)/(1-(x^i)*(z-1))) with C({},x,z) = 1.
Comments