login
Triangle read by rows: T(n,k) = number of compositions of n into k parts such that no two cyclically adjacent parts are equal.
3

%I #15 Jan 19 2018 10:27:04

%S 1,1,0,1,2,0,1,2,0,0,1,4,0,0,0,1,4,6,2,0,0,1,6,6,4,0,0,0,1,6,12,10,0,

%T 0,0,0,1,8,18,16,10,2,0,0,0,1,8,24,40,20,6,0,0,0,0,1,10,30,52,50,18,0,

%U 0,0,0,0,1,10,42,84,90,50,14,2,0,0,0,0

%N Triangle read by rows: T(n,k) = number of compositions of n into k parts such that no two cyclically adjacent parts are equal.

%C Compositions of length 1 are included.

%C See theorem 4 in Hadjicostas reference for generating function.

%H Andrew Howroyd, <a href="/A293595/b293595.txt">Table of n, a(n) for n = 1..1275</a>

%H P. Hadjicostas, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL20/Hadjicostas/hadji5.html">Cyclic, dihedral and symmetric Carlitz compositions of a positive integer</a>, Journal of Integer Sequences, 20 (2017), Article 17.8.5.

%F G.f.: (Sum_{j>=1} x^(2*j)*y^2/(1+x^j*y)) + (Sum_{j>=1} x^j*y/(1+x^j*y)^2) / (1 - Sum_{j>=1} x^j*y/(1+x^j*y)).

%e Triangle begins:

%e 1;

%e 1, 0;

%e 1, 2, 0;

%e 1, 2, 0, 0;

%e 1, 4, 0, 0, 0;

%e 1, 4, 6, 2, 0, 0;

%e 1, 6, 6, 4, 0, 0, 0;

%e 1, 6, 12, 10, 0, 0, 0, 0;

%e 1, 8, 18, 16, 10, 2, 0, 0, 0;

%e 1, 8, 24, 40, 20, 6, 0, 0, 0, 0;

%e ...

%e Case n=6:

%e The included compositions are:

%e k=1: 6; => T(6,1) = 1

%e k=2: 15, 24, 42, 51; => T(6,2) = 4

%e k=3: 123, 132, 213, 231, 312, 321; => T(6,3) = 6

%e k=4: 1212, 2121; => T(6,4) = 2

%t max = 10; gf = Sum[x^(2*j)*y^2/(1 + x^j*y), {j, 1, max}] + Sum[x^j*y/(1 + x^j*y)^2, {j, 1, max}]/(1 - Sum[ x^j*y/(1 + x^j*y), {j, 1, max}]) + O[x]^(max+1) + O[y]^(max+1) // Normal // Expand;

%t T[n_, k_] := SeriesCoefficient[gf, {x, 0, n}, {y, 0, k}];

%t Table[T[n, k], {n, 1, max}, {k, 1, n}] // Flatten (* _Jean-François Alcover_, Jan 19 2018 *)

%o (PARI)

%o gf(n,y) = {my(A=sum(j=1, n, x^(2*j)*y^2/(1+x^j*y) + O(x*x^n)),

%o B=sum(j=1, n, x^j*y/(1+x^j*y)^2 + O(x*x^n)),

%o C=sum(j=1, n, x^j*y/(1+x^j*y) + O(x*x^n)));

%o A + B/(1-C)}

%o for(n=1,10,my(p=polcoeff(gf(n,y),n));for(k=1,n,print1(polcoeff(p,k),", "));print)

%Y Row sums are in A212322.

%Y Cf. A106351, A106369.

%K nonn,tabl

%O 1,5

%A _Andrew Howroyd_, Oct 12 2017