cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A309931 Triangle read by rows: T(n,k) is the number of compositions of n with k parts and circular differences all equal to 1, 0, or -1.

This page as a plain text file.
%I A309931 #9 Aug 24 2019 02:26:52
%S A309931 1,1,1,1,2,1,1,1,3,1,1,2,3,4,1,1,1,1,6,5,1,1,2,3,4,10,6,1,1,1,3,5,10,
%T A309931 15,7,1,1,2,1,4,10,20,21,8,1,1,1,3,6,11,21,35,28,9,1,1,2,3,4,10,24,42,
%U A309931 56,36,10,1,1,1,1,5,10,25,49,78,84,45,11,1
%N A309931 Triangle read by rows: T(n,k) is the number of compositions of n with k parts and circular differences all equal to 1, 0, or -1.
%F A309931 T(n, 1) = T(n, n) = 1.
%F A309931 T(n, 2) = (3 - (-1)^n)/2.
%F A309931 T(n, n - 1) = binomial(n-1, 1) = n - 1.
%F A309931 T(n, n - 2) = binomial(n-2, 2).
%e A309931 Triangle begins:
%e A309931   1;
%e A309931   1, 1;
%e A309931   1, 2, 1;
%e A309931   1, 1, 3, 1;
%e A309931   1, 2, 3, 4,  1;
%e A309931   1, 1, 1, 6,  5,  1;
%e A309931   1, 2, 3, 4, 10,  6,  1;
%e A309931   1, 1, 3, 5, 10, 15,  7,   1;
%e A309931   1, 2, 1, 4, 10, 20, 21,   8,   1;
%e A309931   1, 1, 3, 6, 11, 21, 35,  28,   9,   1;
%e A309931   1, 2, 3, 4, 10, 24, 42,  56,  36,  10,   1;
%e A309931   1, 1, 1, 5, 10, 25, 49,  78,  84,  45,  11,  1;
%e A309931   1, 2, 3, 4, 10, 24, 56,  96, 135, 120,  55, 12,  1;
%e A309931   1, 1, 3, 6, 10, 21, 57, 116, 180, 220, 165, 66, 13, 1;
%e A309931   ...
%e A309931 For n = 6 there are a total of 15 compositions:
%e A309931   k = 1: (6)
%e A309931   k = 2: (33)
%e A309931   k = 3: (222)
%e A309931   k = 4: (1122), (1212), (1221), (2112), (2121), (2211)
%e A309931   k = 5: (11112), (11121), (11211), (12111), (21111)
%e A309931   k = 6: (111111)
%o A309931 (PARI)
%o A309931 step(R,n)={matrix(n, n, i, j, if(i>j, if(j>1, R[i-j, j-1]) + R[i-j, j] + if(j+1<=n, R[i-j, j+1])) )}
%o A309931 T(n)={my(v=vector(n)); for(k=1, n, my(R=matrix(n, n, i, j, i==j&&abs(i-k)<=1), m=0); while(R, m++; v[m]+=R[n, k]; R=step(R, n))); v}
%o A309931 for(n=1, 12, print(T(n)));
%Y A309931 Row sums are A325591.
%Y A309931 Cf. A309937, A309938, A309939.
%K A309931 nonn,tabl
%O A309931 1,5
%A A309931 _Andrew Howroyd_, Aug 23 2019