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 A364039 #37 Sep 15 2023 06:12:00 %S A364039 1,0,1,0,0,1,0,1,1,1,0,1,0,0,1,0,0,2,1,0,1,0,2,1,1,0,0,1,0,1,1,1,1,0, %T A364039 0,1,0,1,3,2,0,0,0,0,1,0,3,2,1,2,1,0,0,0,1,0,2,3,2,1,0,0,0,0,0,1,0,3, %U A364039 4,3,1,1,1,0,0,0,0,1,0,4,4,4,2,1,0,0,0,0,0,0,1 %N A364039 Triangle read by rows: T(n,k) is the number of integer compositions of n with first part k and differences between neighboring parts in {-1,1}. %H A364039 Alois P. Heinz, <a href="/A364039/b364039.txt">Rows n = 0..200, flattened</a> %F A364039 T(n,n) = 1. %F A364039 T(n,k) = T(n-k,k+1) + T(n-k,k-1) for 0 < k < n. %F A364039 T(n,k) = 0 for n < k. %F A364039 T(n,0) = 0 for 0 < n. %e A364039 Triangle begins: %e A364039 1; %e A364039 0, 1; %e A364039 0, 0, 1; %e A364039 0, 1, 1, 1; %e A364039 0, 1, 0, 0, 1; %e A364039 0, 0, 2, 1, 0, 1; %e A364039 0, 2, 1, 1, 0, 0, 1; %e A364039 0, 1, 1, 1, 1, 0, 0, 1; %e A364039 0, 1, 3, 2, 0, 0, 0, 0, 1; %e A364039 0, 3, 2, 1, 2, 1, 0, 0, 0, 1; %e A364039 0, 2, 3, 2, 1, 0, 0, 0, 0, 0, 1; %e A364039 ... %e A364039 For n = 6 there are a total of 5 compositions: %e A364039 T(6,1) = 2: (123), (1212) %e A364039 T(6,2) = 1: (2121) %e A364039 T(6,3) = 1: (321) %e A364039 T(6,6) = 1: (6) %p A364039 T:= proc(n, i) option remember; `if`(n<1 or i<1, 0, %p A364039 `if`(n=i, 1, add(T(n-i, i+j), j=[-1, 1]))) %p A364039 end: T(0$2):=1: %p A364039 seq(seq(T(n, k), k=0..n), n=0..14); # _Alois P. Heinz_, Aug 08 2023 %o A364039 (Python) %o A364039 def A364039_rowlist(row_max): %o A364039 A = [] %o A364039 for n in range(0,row_max+1): %o A364039 A.append([]) %o A364039 for k in range(0,n+1): %o A364039 z = 0 %o A364039 if n==k: z += 1 %o A364039 elif k > 1 and k-1 <= n-k: z += A[n-k][k-1] %o A364039 if k+1 <= n-k and k != 0: z += A[n-k][k+1] %o A364039 A[n].append(z) %o A364039 print(A[n]) %o A364039 A364039_rowlist(12) %Y A364039 Cf. A291905 (column k=1), A173258 (row sums). %Y A364039 Cf. A227310, A291904, A309938, A362500, A364529. %K A364039 nonn,easy,tabl %O A364039 0,18 %A A364039 _John Tyler Rascoe_, Aug 06 2023