A309937 Irregular triangle read by rows: T(n,k) is the number of compositions of n with 2k parts and circular differences all equal to 1 or -1, (n >= 3, 1 <= k <= n/3).
2, 0, 2, 0, 2, 2, 0, 0, 4, 2, 0, 2, 0, 2, 0, 2, 0, 6, 0, 4, 0, 2, 2, 0, 6, 0, 0, 2, 0, 8, 2, 0, 8, 0, 2, 0, 4, 0, 12, 0, 2, 0, 6, 0, 10, 0, 2, 0, 16, 0, 2, 2, 0, 6, 0, 20, 0, 0, 4, 0, 18, 0, 12, 2, 0, 8, 0, 30, 0, 2, 0, 2, 0, 16, 0, 30, 0, 2, 0, 6, 0, 40, 0, 14, 0, 4, 0, 20, 0, 52, 0, 2
Offset: 3
Examples
Triangle begins: 2; 0; 2; 0, 2; 2, 0; 0, 4; 2, 0, 2; 0, 2, 0; 2, 0, 6; 0, 4, 0, 2; 2, 0, 6, 0; 0, 2, 0, 8; 2, 0, 8, 0, 2; 0, 4, 0, 12, 0; 2, 0, 6, 0, 10; 0, 2, 0, 16, 0, 2; 2, 0, 6, 0, 20, 0; 0, 4, 0, 18, 0, 12; 2, 0, 8, 0, 30, 0, 2; 0, 2, 0, 16, 0, 30, 0; 2, 0, 6, 0, 40, 0, 14; 0, 4, 0, 20, 0, 52, 0, 2; 2, 0, 6, 0, 42, 0, 42, 0; 0, 2, 0, 16, 0, 78, 0, 16; 2, 0, 8, 0, 50, 0, 84, 0, 2; 0, 4, 0, 18, 0, 96, 0, 56, 0; 2, 0, 6, 0, 50, 0, 140, 0, 18; 0, 2, 0, 16, 0, 116, 0, 128, 0, 2; ... For n = 11 there are a total of 8 compositions: k = 1: (56), (65) k = 3: (121232), (123212), (212123), (212321), (232121), (321212)
Programs
-
PARI
step(R,n)={matrix(n,n,i,j, if(i>j, if(j>1, R[i-j,j-1]) + if(j+1<=n, R[i-j,j+1])))} T(n)={my(v=vector(n\3)); for(k=1, n, my(R=matrix(n,n,i,j,i==j&&abs(i-k)==1), m=0); while(R, m++; if(m%2==0, v[m/2]+=R[n,k]); R=step(R,n))); v} for(n=3, 24, print(T(n)))
Comments