%I #19 Feb 06 2017 14:21:40
%S 1,1,1,1,1,2,1,1,3,5,1,1,4,7,14,1,1,5,9,23,43,1,1,6,11,34,71,141,1,1,
%T 7,13,47,105,255,490,1,1,8,15,62,145,411,911,1785,1,1,9,17,79,191,615,
%U 1496,3535,6789,1,1,10,19,98,243,873,2269,6169,13903,26809
%N A(n,k) is the sum over all Motzkin paths of length n of products over all peaks p of (x_p+k*y_p)/y_p, where x_p and y_p are the coordinates of peak p; square array A(n,k), n>=0, k>=0, read by antidiagonals.
%H Alois P. Heinz, <a href="/A258306/b258306.txt">Antidiagonals n = 0..140, flattened</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Motzkin_number">Motzkin number</a>
%F A(n,k) = Sum_{i=0..min(floor(n/2),k)} C(k,i) * i! * A258307(n,i).
%e Square array A(n,k) begins:
%e : 1, 1, 1, 1, 1, 1, 1, ...
%e : 1, 1, 1, 1, 1, 1, 1, ...
%e : 2, 3, 4, 5, 6, 7, 8, ...
%e : 5, 7, 9, 11, 13, 15, 17, ...
%e : 14, 23, 34, 47, 62, 79, 98, ...
%e : 43, 71, 105, 145, 191, 243, 301, ...
%e : 141, 255, 411, 615, 873, 1191, 1575, ...
%p b:= proc(x, y, t, k) option remember; `if`(y>x or y<0, 0,
%p `if`(x=0, 1, b(x-1, y-1, false, k)*`if`(t, (x+k*y)/y, 1)
%p +b(x-1, y, false, k) +b(x-1, y+1, true, k)))
%p end:
%p A:= (n, k)-> b(n, 0, false, k):
%p seq(seq(A(n, d-n), n=0..d), d=0..12);
%t b[x_, y_, t_, k_] := b[x, y, t, k] = If[y > x || y < 0, 0, If[x == 0, 1, b[x - 1, y - 1, False, k]*If[t, (x + k*y)/y, 1] + b[x - 1, y, False, k] + b[x - 1, y + 1, True, k]]]; A[n_, k_] := b[n, 0, False, k]; Table[A[n, d - n], {d, 0, 12}, {n, 0, d}] // Flatten (* _Jean-François Alcover_, Jan 23 2017, translated from Maple *)
%Y Columns k=0-1 give: A258312, A140456(n+2).
%Y Main diagonal gives A266386.
%Y Cf. A258307, A258309.
%K nonn,tabl
%O 0,6
%A _Alois P. Heinz_, May 25 2015