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)
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)
A374925
Number of n-color compositions of n having at least one pair of adjacent parts that are the same color.
Original entry on oeis.org
0, 0, 1, 3, 10, 31, 91, 259, 726, 2007, 5489, 14888, 40122, 107574, 287239, 764405, 2028679, 5371858, 14198008, 37467982, 98749767, 259984452, 683865318, 1797500121, 4721662597, 12396308875, 32531025970, 85337831350, 223794544179, 586736215856, 1537941527011
Offset: 0
a(4) = 10 counts: (1,1,1,1), (1,1,2_a), (1,1,2_b), (1,2_a,1), (1,3_a), (2_a,1,1), (2_a,2_a), (2_b,1,1), (2_b,2_b), (3_a,1).
-
C_x(N) = {my(x='x+O('x^N), h=(sum(i=1,N,(x^(2*i))/((1-x)*(1-x+x^i)*(1-sum(j=1,N, (x^j)/(1-x+x^j))))))/(1-sum(i=1,N,(x^i)/(1-x)))); concat([0,0],Vec(h))}
C_x(40)
Showing 1-3 of 3 results.
Comments