OFFSET
0,4
COMMENTS
An integer composition is complete if its set of parts covers an initial interval.
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.
EXAMPLE
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.
PROG
(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)
CROSSREFS
KEYWORD
nonn
AUTHOR
John Tyler Rascoe, Jan 14 2025
STATUS
approved
