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.

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

This page as a plain text file.
%I A309939 #17 Aug 24 2019 02:26:01
%S A309939 1,1,1,1,2,1,1,1,3,1,1,2,3,4,1,1,1,3,6,5,1,1,2,3,6,10,6,1,1,1,3,7,12,
%T A309939 15,7,1,1,2,3,6,14,22,21,8,1,1,1,3,8,15,27,37,28,9,1,1,2,3,6,16,32,50,
%U A309939 58,36,10,1,1,1,3,7,16,35,63,88,86,45,11,1
%N A309939 Triangle read by rows: T(n,k) is the number of compositions of n with k parts and differences all equal to 1, 0, or -1.
%F A309939 T(n, 1) = T(n, n) = 1.
%F A309939 T(n, 2) = (3 - (-1)^n)/2 for n > 1.
%F A309939 T(n, 3) = 3 for n > 3.
%F A309939 T(n, n - 1) = binomial(n-1, 1) = n - 1.
%F A309939 T(n, n - 2) = binomial(n-2, 2).
%e A309939 Triangle begins:
%e A309939   1;
%e A309939   1, 1;
%e A309939   1, 2, 1;
%e A309939   1, 1, 3, 1;
%e A309939   1, 2, 3, 4,  1;
%e A309939   1, 1, 3, 6,  5,  1;
%e A309939   1, 2, 3, 6, 10,  6,  1;
%e A309939   1, 1, 3, 7, 12, 15,  7,   1;
%e A309939   1, 2, 3, 6, 14, 22, 21,   8,   1;
%e A309939   1, 1, 3, 8, 15, 27, 37,  28,   9,   1;
%e A309939   1, 2, 3, 6, 16, 32, 50,  58,  36,  10,   1;
%e A309939   1, 1, 3, 7, 16, 35, 63,  88,  86,  45,  11,   1;
%e A309939   1, 2, 3, 6, 16, 38, 74, 118, 147, 122,  55,  12,  1;
%e A309939   1, 1, 3, 8, 16, 37, 83, 148, 212, 234, 167,  66, 13,  1;
%e A309939   1, 2, 3, 6, 17, 40, 88, 174, 282, 366, 357, 222, 78, 14, 1;
%e A309939   ...
%e A309939 For n = 6 there are a total of 17 compositions:
%e A309939   k = 1: (6)
%e A309939   k = 2: (33)
%e A309939   k = 3: (123), (222), (321)
%e A309939   k = 4: (1122), (1212), (1221), (2112), (2121), (2211)
%e A309939   k = 5: (11112), (11121), (11211), (12111), (21111)
%e A309939   k = 6: (111111)
%o A309939 (PARI)
%o A309939 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 A309939 T(n)={my(v=vector(n), R=matid(n), m=0); while(R, m++; v[m]+=vecsum(R[n,]); R=step(R,n)); v}
%o A309939 for(n=1, 12, print(T(n)))
%Y A309939 Row sums are A034297.
%Y A309939 Cf. A309931, A309937, A309938.
%K A309939 nonn,tabl
%O A309939 1,5
%A A309939 _Andrew Howroyd_, Aug 23 2019