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 A372014 #22 Apr 16 2024 19:05:28 %S A372014 1,0,1,1,1,1,2,2,2,1,4,6,4,3,1,8,14,12,7,4,1,18,32,33,21,11,5,1,44,74, %T A372014 84,64,34,16,6,1,113,180,208,181,111,52,22,7,1,296,457,520,485,344, %U A372014 179,76,29,8,1,782,1195,1334,1273,1000,599,274,107,37,9,1 %N A372014 T(n,k) is the total number of levels in all Motzkin paths of length n containing exactly k path nodes; triangle T(n,k), n>=0, 1<=k<=n+1, read by rows. %C A372014 A Motzkin path of length n has n+1 nodes. %H A372014 Alois P. Heinz, <a href="/A372014/b372014.txt">Rows n = 0..28, flattened</a> %H A372014 Wikipedia, <a href="https://en.wikipedia.org/wiki/Motzkin_number">Motzkin number</a> %F A372014 Sum_{k=1..n+1} k * T(n,k) = A005717(n+1) = (n+1) * A001006(n). %e A372014 In the A001006(3) = 4 Motzkin paths of length 3 there are 2 levels with 1 node, 2 levels with 2 nodes, 2 levels with 3 nodes, and 1 level with 4 nodes. %e A372014 2 _ 1 1 %e A372014 2 / \ 3 /\_ 3 _/\ 4 ___ . %e A372014 So row 3 is [2, 2, 2, 1]. %e A372014 Triangle T(n,k) begins: %e A372014 1; %e A372014 0, 1; %e A372014 1, 1, 1; %e A372014 2, 2, 2, 1; %e A372014 4, 6, 4, 3, 1; %e A372014 8, 14, 12, 7, 4, 1; %e A372014 18, 32, 33, 21, 11, 5, 1; %e A372014 44, 74, 84, 64, 34, 16, 6, 1; %e A372014 113, 180, 208, 181, 111, 52, 22, 7, 1; %e A372014 296, 457, 520, 485, 344, 179, 76, 29, 8, 1; %e A372014 782, 1195, 1334, 1273, 1000, 599, 274, 107, 37, 9, 1; %e A372014 ... %p A372014 g:= proc(x, y, p) (h-> `if`(x=0, add(z^coeff(h, z, i) %p A372014 , i=0..degree(h)), b(x, y, h)))(p+z^y) end: %p A372014 b:= proc(x, y, p) option remember; `if`(y+2<=x, g(x-1, y+1, p), 0) %p A372014 +`if`(y+1<=x, g(x-1, y, p), 0)+`if`(y>0, g(x-1, y-1, p), 0) %p A372014 end: %p A372014 T:= n-> (p-> seq(coeff(p, z, i), i=1..n+1))(g(n, 0$2)): %p A372014 seq(T(n), n=0..10); %Y A372014 Columns k=1-2 give: A088457, A051485. %Y A372014 Row sums give A372033 = A001006 + A333498. %Y A372014 Cf. A005717, A371928. %K A372014 nonn,tabl %O A372014 0,7 %A A372014 _Alois P. Heinz_, Apr 15 2024