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.
%I A309938 #22 Sep 06 2023 13:24:47 %S A309938 1,1,0,1,2,0,1,0,1,0,1,2,1,0,0,1,0,2,2,0,0,1,2,1,0,1,0,0,1,0,1,4,1,0, %T A309938 0,0,1,2,2,0,3,2,0,0,0,1,0,1,4,2,0,1,0,0,0,1,2,1,0,3,6,1,0,0,0,0,1,0, %U A309938 2,4,3,0,4,2,0,0,0,0,1,2,1,0,3,8,3,0,1,0,0,0,0 %N A309938 Triangle read by rows: T(n,k) is the number of compositions of n with k parts and differences all equal to 1 or -1. %C A309938 Parts will alternate between being odd and even. For even k, a composition cannot be the same as its reversal and therefore for even k, T(n,k) is even. %H A309938 Alois P. Heinz, <a href="/A309938/b309938.txt">Rows n = 1..200, flattened</a> %e A309938 Triangle begins: %e A309938 1; %e A309938 1, 0; %e A309938 1, 2, 0; %e A309938 1, 0, 1, 0; %e A309938 1, 2, 1, 0, 0; %e A309938 1, 0, 2, 2, 0, 0; %e A309938 1, 2, 1, 0, 1, 0, 0; %e A309938 1, 0, 1, 4, 1, 0, 0, 0; %e A309938 1, 2, 2, 0, 3, 2, 0, 0, 0; %e A309938 1, 0, 1, 4, 2, 0, 1, 0, 0, 0; %e A309938 1, 2, 1, 0, 3, 6, 1, 0, 0, 0, 0; %e A309938 1, 0, 2, 4, 3, 0, 4, 2, 0, 0, 0, 0; %e A309938 1, 2, 1, 0, 3, 8, 3, 0, 1, 0, 0, 0, 0; %e A309938 1, 0, 1, 4, 3, 0, 6, 8, 1, 0, 0, 0, 0, 0; %e A309938 1, 2, 2, 0, 4, 10, 5, 0, 5, 2, 0, 0, 0, 0, 0; %e A309938 ... %e A309938 For n = 6 there are a total of 5 compositions: %e A309938 k = 1: (6) %e A309938 k = 3: (123), (321) %e A309938 k = 4: (2121), (1212) %p A309938 b:= proc(n, i) option remember; `if`(n<1 or i<1, 0, %p A309938 `if`(n=i, x, add(expand(x*b(n-i, i+j)), j=[-1, 1]))) %p A309938 end: %p A309938 T:= n-> (p-> seq(coeff(p, x, i), i=1..n))(add(b(n, j), j=1..n)): %p A309938 seq(T(n), n=1..14); # _Alois P. Heinz_, Jul 22 2023 %t A309938 b[n_, i_] := b[n, i] = If[n < 1 || i < 1, 0, If[n == i, x, Sum[Expand[x*b[n - i, i + j]], {j, {-1, 1}}]]]; %t A309938 T[n_] := CoefficientList[Sum[b[n, j], {j, 1, n}], x] // Rest // PadRight[#, n]&; %t A309938 Table[T[n], {n, 1, 13}] // Flatten (* _Jean-François Alcover_, Sep 06 2023, after _Alois P. Heinz_ *) %o A309938 (PARI) %o A309938 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])) )} %o A309938 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 A309938 for(n=1, 15, print(T(n))) %Y A309938 Row sums are A173258. %Y A309938 T(2n,n) gives A364529. %Y A309938 Cf. A309931, A309937, A309939, A325557. %K A309938 nonn,tabl %O A309938 1,5 %A A309938 _Andrew Howroyd_, Aug 23 2019