Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #53 Dec 11 2022 02:14:03
%S 0,1,2,6,25,127,768,5401,43335,390783,3913231,43088876,517457295,
%T 6730858066,94275101800,1414643984295,22641034606786,384991863417162,
%U 6931268185493211,131716736558977795,2634719723042973062
%N Let M(n) = {{n, 0, 1}, {1, 0, 0}, {0, 1, 0}}, then a(n) is the upper-right term of M(n)*M(n-1)*...*M(1).
%C Equivalently, a(n) is the middle-left term of M(1)*M(2)*...*M(n). - _Jianing Song_, Sep 24 2018
%F a(n) = n*a(n-1) + a(n-3) for n >= 3. - _David A. Corneth_, Sep 24 2018
%F E.g.f.: A'''(x), where A'''(x) = A(x)/(1 - x) + x + x^2, A(0) = A'(0) = A''(0) = 0.
%t M[n_] := {{n, 0, 1}, {1, 0, 0}, {0, 1, 0}};
%t v[0] = {0, 0, 1};
%t v[n_] := v[n] = M[n].v[n - 1];
%t a = Table[v[n][[1]], {n, 0, 30}]
%o (PARI) a(n) = if(n<3, n, n*a(n-1) + a(n-3)) \\ _Jianing Song_, Sep 24 2018
%o (PARI) M(n) = [n, 0, 1; 1, 0, 0; 0, 1, 0];
%o lista(nn) = {v = [0, 0, 1]; for (n=0, nn, Mn = M(n); v = vector(3, k, sum(i=1, 3, Mn[i,k]*v[i])); print1(v[1], ", "););} \\ _Michel Marcus_, Sep 24 2018
%o (PARI) a=vector(50); a[1]=1; a[2]=2; a[3]=6; for(n=4, #a, a[n]=n*a[n-1]+a[n-3]); concat(0, a) \\ _Altug Alkan_, Sep 24 2018
%Y Cf. A001053.
%K nonn,easy
%O 0,3
%A _Roger L. Bagula_, Jun 18 2007
%E Edited, new name, and offset corrected by _Jianing Song_, Sep 24 2018