A374726
Number of gap-free Carlitz compositions of n.
Original entry on oeis.org
1, 1, 3, 2, 4, 9, 11, 11, 29, 53, 82, 129, 215, 389, 726, 1237, 2079, 3660, 6386, 11127, 19719, 34658, 60358, 105776, 185641, 324822, 569565, 999824, 1753763, 3075263, 5390839, 9452903, 16579307, 29065205, 50947822, 89330076, 156628094, 274559046, 481250343
Offset: 1
a(6) = 9 counts: (1,2,1,2), (2,1,2,1), (1,2,3), (1,3,2), (2,1,3), (2,3,1), (3,1,2), (3,2,1), (6).
-
Ca_x(s, N)={my(x='x+O('x^N), g=if(#s <1, 1, sum(i=1, #s, (Ca_x(s[^i], N) * x^(s[i])/(1+x^(s[i]))))/(1-sum(i=1, #s, (x^(s[i]))/(1+x^(s[i])))))); return(g)}
B_x(N)={my(x='x+O('x^N), j=1, h=0); while((j*(j+1))/2 <= N, for(k=0,N, h += Ca_x([(1+k)..(j+k)], N+1)); j++); my(a = Vec(h)); vector(N, i, a[i])}
B_x(20)
A374727
Number of n-color complete compositions of n.
Original entry on oeis.org
1, 1, 1, 1, 7, 13, 45, 91, 233, 477, 1079, 2205, 4709, 10299, 22393, 52005, 125055, 310373, 799677, 2096699, 5556681, 14806685, 39417431, 104570549, 276027337, 724183555, 1887993925, 4891368373, 12595644523, 32252683453, 82146468813, 208225916203, 525472131209
Offset: 1
a(6) = 13 counts: (1,1,1,1,1,1) and the 12 permutations of parts 1, 1, 2_a, and 2_b.
-
colr(x,y)={my(r=y-x+1, v=[x..y], z = vector(r*(r+(1+(x-1)*2))/2), k=1); for(i=1,#v,for(j=1,v[i],z[k]=v[i]; k++)); return(z)}
C_x(s,N)={my(x='x+O('x^N), g=if(#s <1,1, sum(i=1,#s, C_x(s[^i],N) * x^(s[i]) )/(1-sum(i=1,#s, x^(s[i]))))); return(g)}
B_x(N)={my(x='x+O('x^N), j=1, h=0, s=colr(1,j)); while(vecsum(s) <= N, h += C_x(s,N+1); j++;s=colr(1,j)); my(a = Vec(h)); vector(N, i, a[i])}
B_x(25)
A374728
Number of n-color gap-free compositions of n.
Original entry on oeis.org
1, 1, 1, 3, 7, 19, 45, 105, 239, 507, 1079, 2303, 4829, 10425, 23263, 53363, 127995, 318983, 816057, 2133241, 5640135, 14975051, 39772751, 105322879, 277547989, 727276225, 1894282195, 4903985955, 12621154315, 32302574959, 82248961437, 208426306113, 525884062427
Offset: 1
a(5) = 7 counts: (1,1,1,1,1), (1,2_a,2_b), (1,2_b,2_a), (2_a,1,2_b), (2_a,2_b,1), (2_b,1,2_a), (2_b,2_a,1).
-
colr(x,y)={my(r=y-x+1, v=[x..y], z = vector(r*(r+(1+(x-1)*2))/2), k=1); for(i=1,#v,for(j=1,v[i],z[k]=v[i]; k++)); return(z)}
C_x(s,N)={my(x='x+O('x^N), g=if(#s <1,1, sum(i=1,#s, C_x(s[^i],N+1) * x^(s[i]) )/(1-sum(i=1,#s, x^(s[i]))))); return(g)}
B_x(N)={my(x='x+O('x^N), h=0); for(u=1,N, my(j=0); while(vecsum(colr(u,u+j)) <= N, h += C_x(colr(u,u+j),N+1); j++)); my(a = Vec(h)); vector(N, i, a[i])}
B_x(20)
A379836
Number of pairs of adjacent equal parts in all complete compositions of n.
Original entry on oeis.org
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
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.
-
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)
A380176
Number of pairs of adjacent equal parts in all gap-free compositions of n.
Original entry on oeis.org
0, 0, 1, 2, 6, 12, 26, 56, 124, 266, 563, 1204, 2573, 5468, 11559, 24370, 51281, 107720, 225867, 472660, 987378, 2059180, 4287932, 8916624, 18517398, 38406486, 79563118, 164636582, 340308519, 702713844, 1449664783, 2987870476, 6152930738, 12660419370, 26030245642
Offset: 0
The gap-free compositions of n = 4 are: (4), (2,2), (1,1,2), (1,2,1), (2,1,1), and (1,1,1,1); having a total of 6 pairs of equal adjacent parts giving a(4) = 6.
-
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, for(k=0,N, h += C_xz([(1+k)..(j+k)], 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)
Showing 1-5 of 5 results.
Comments