%I #41 Oct 06 2019 05:36:00
%S 1,1,3,7,22,63,191,573,1752,5372,16597,51465,160258,500551,1567881,
%T 4922687,15488481,48821964,154147654,487412324,1543231353,4891986889,
%U 15524303265,49314008259,156791992914,498931763064,1588891019625
%N Main diagonal of triangle A092565, in which the n-th row polynomial equals the numerator of the n-th convergent of the continued fraction [1 + x + x^2; 1 + x + x^2, 1 + x + x^2, ...].
%C T(n,k) is the number of lattice paths from (0,0) to (n,k) using steps (1,0), (2,0), (1,1), and (1,2). - _Joerg Arndt_, Jun 30 2011
%C Diagonal of rational function 1/(1 - (x + x^2 + x*y + x*y^2)). - _Gheorghe Coserea_, Aug 06 2018
%H Alois P. Heinz, <a href="/A092566/b092566.txt">Table of n, a(n) for n = 0..1959</a>
%F a(n) = sum(k=0..n, A037027(n, k)*C(k, n-k) ).
%F O.g.f. A(x) satisfies the equation (27*x^4 - 14*x^3 + 9*x^2 + 14*x - 5)*A(x)^3 + (4-3*x)*A(x) + 1 = 0. - _Mark van Hoeij_, Apr 16 2013
%p series(RootOf((27*x^4-14*x^3+9*x^2+14*x-5)*y^3+(4-3*x)*y+1, y), x=0, 30); # _Mark van Hoeij_, Apr 16 2013
%t A037027[n_, k_] := Sum[Binomial[k+j, k]*Binomial[j, n-j-k], {j, 0, n-k}]; A037027[n_, 0] = Fibonacci[n+1]; a[n_] := Sum[A037027[n, k]*Binomial[k, n-k], {k, 0, n}]; Table[a(n), {n,0,26}] (* _Jean-François Alcover_, Jul 18 2011 *)
%t a[0, 0] = 1; a[n_, k_] /; n >= 0 && k >= 0 := a[n, k] = a[n, k-1] + a[n, k-2] + a[n-1, k-1] + a[n-2, k-1]; a[_, _] = 0;
%t a[n_] := a[n, n];
%t a /@ Range[0, 30] (* _Jean-François Alcover_, Oct 06 2019, after _Joerg Arndt_ *)
%o (PARI) a(n)=if(n<0,0,polcoeff(contfracpnqn(vector(n,i,1+x+x^2))[1,1],n,x))
%o (PARI) A037027(n,k)=if(n<k || k<0,0,sum(j=0,n-k,binomial(j+k,k)*binomial(j,n- j-k))) a(n)=sum(k=0,n, A037027(n,k)*binomial(k,n-k))
%o (PARI) /* computation as lattice paths: */
%o N=40; /* that many terms */
%o B=matrix(N,N); B[1,1]=1; /* whether T(n,k) memoized */
%o M=matrix(N,N); M[1,1]=1; /* memoization for T(n,k) */
%o steps=[[1,0], [2,0], [1,1], [1,2]];
%o T(n,k)=
%o {
%o my(ret, dx, dy);
%o if ( n<0, return(0) );
%o if ( k<0, return(0) );
%o if ( B[n+1,k+1], return( M[n+1,k+1]) );
%o ret = 0;
%o for (s=1, #steps,
%o dx = steps[s][1];
%o dy = steps[s][2];
%o ret += T( n-dx, k-dy );
%o );
%o B[n+1,k+1] = 1;
%o M[n+1,k+1] = ret;
%o return( ret );
%o }
%o T(N-1,N-1); /* trigger computations */
%o for (n=1,N, print1(M[n,n],", ")); /* show (diagonal) terms */
%o for(n=0,N-1,for(k=0,n,print1(T(n,k),", "););print();); /* show triangle */
%o /* _Joerg Arndt_, Jun 30 2011 */
%Y Cf. A092565, A037027.
%K nonn,nice
%O 0,3
%A _Paul D. Hanna_, Feb 28 2004