A059450 Triangle read by rows: T(n,k) = Sum_{j=0..k-1} T(n,j) + Sum_{j=1..n-k} T(n-j,k), with T(0,0)=1 and T(n,k) = 0 for k > n.
1, 1, 1, 2, 3, 5, 4, 8, 17, 29, 8, 20, 50, 107, 185, 16, 48, 136, 336, 721, 1257, 32, 112, 352, 968, 2370, 5091, 8925, 64, 256, 880, 2640, 7116, 17304, 37185, 65445, 128, 576, 2144, 6928, 20168, 53596, 129650, 278635, 491825, 256, 1280, 5120, 17664, 54880
Offset: 0
Examples
1; 1, 1; 2, 3, 5; 4, 8, 17, 29; 8, 20, 50, 107, 185;
References
- Wen-jin Woan, Diagonal lattice paths, Congressus Numerantium, 151, 2001, 173-178.
Links
- Peter Kagey, Table of n, a(n) for n = 0..10011 (141 rows flattened, first 50 rows from G. C. Greubel)
- C. Coker, Enumerating a class of lattice paths, Discrete Math., 271 (2003), 13-28.
Crossrefs
Programs
-
Maple
l := 1:a[0,0] := 1:b[l] := 1:T := (n,k)->sum(a[n,j],j=0..k-1)+sum(a[n-j,k],j=1..n-k): for n from 1 to 15 do for k from 0 to n do a[n,k] := T(n,k):l := l+1:b[l] := a[n,k]: od:od:seq(b[w],w=1..l); # Sascha Kurz # alternative A059450 := proc(n,k) option remember; local j ; if k =0 and n= 0 then 1; elif k > n or k < 0 then 0 ; else add( procname(n,j),j=0..k-1) + add(procname(n-j,k),j=1..n-k) ; end if; end proc: seq(seq(A059450(n,k),k=0..n),n=0..12) ; # R. J. Mathar, Mar 25 2024
-
Mathematica
t[0, 0] = 1; t[n_, k_] /; k > n = 0; t[n_, k_] := t[n, k] = Sum[t[n, j], {j, 0, k-1}] + Sum[t[n-j, k], {j, 1, n-k}]; Table[t[n, k], {n, 0, 9}, {k, 0, n}] // Flatten (* Jean-François Alcover, Jan 08 2014 *)
-
PARI
T(n,k)=if(k<0||k>n,0,polcoeff(polcoeff(2*(1-x)/((1-4*x+3*x*y)+sqrt((1-x*y)*(1-9*x*y)+x^2*O(x^n))),n),k)) /* Michael Somos, Mar 06 2004 */
-
PARI
T(n,k)=local(A,t);if(k<0||k>n,0,A=matrix(n+1,n+1);A[1,1]=1;for(m=1,n,t=0;for(j=0,m,t+=(A[m+1,j+1]=t+sum(i=1,m-j,A[m-i+1,j+1]))));A[n+1,k+1]) /* Michael Somos, Mar 06 2004 */
-
PARI
T(n,k)=if(k<0||k>n,0,(n==0)+sum(j=0,k-1,T(n,j))+sum(j=1,n-k,T(n-j,k))) /* Michael Somos, Mar 06 2004 */
Extensions
More terms from Ray Chandler, Sep 17 2003
Comments