login
Define an array by d(m, 0) = 1, d(m, 1) = m; d(m, k) = (m - k + 1) d(m+1, k-1) - (k-1) (m+1) d(m+2, k-2). Sequence gives d(1,n).
2

%I #9 Sep 08 2022 08:45:29

%S 1,1,-2,-12,24,420,-720,-30240,40320,3764880,-3628800,-728481600,

%T 479001600,203545742400,-87178291200,-77806624896000,20922789888000,

%U 39045031657632000,-6402373705728000,-24904933604014464000,2432902008176640000,19678195269815322240000,-1124000727777607680000

%N Define an array by d(m, 0) = 1, d(m, 1) = m; d(m, k) = (m - k + 1) d(m+1, k-1) - (k-1) (m+1) d(m+2, k-2). Sequence gives d(1,n).

%D V. van der Noort and N. J. A. Sloane, Paper in preparation, 2007.

%H G. C. Greubel, <a href="/A126962/b126962.txt">Table of n, a(n) for n = 0..150</a>

%p T:= proc(n, k) option remember;

%p if k=0 then 1

%p elif k=1 then n

%p else (n-k+1)*T(n+1, k-1) - (k-1)*(n+1)*T(n+2, k-2)

%p fi; end:

%p seq(T(1, n), n=0..25); # _G. C. Greubel_, Jan 29 2020

%t T[n_, k_]:= T[n, k]= If[k==0, 1, If[k==1, n, (n-k+1)*T[n+1, k-1] - (k-1)*(n+1)* T[n+2, k-2]]]; Table[T[1, n], {n,0,25}] (* _G. C. Greubel_, Jan 29 2020 *)

%o (PARI) T(n,k) = if(k==0, 1, if(k==1, n, (n-k+1)*T(n+1, k-1) - (k-1)*(n+1)*T(n+2, k-2) ));

%o vector(25, n, T(1, (n-1)) ) \\ _G. C. Greubel_, Jan 29 2020

%o (Magma)

%o function T(n,k)

%o if k eq 0 then return 1;

%o elif k eq 1 then return n;

%o else return (n-k+1)*T(n+1, k-1) - (k-1)*(n+1)*T(n+2, k-2);

%o end if; return T; end function;

%o [T(1,n): n in [0..25]]; // _G. C. Greubel_, Jan 29 2020

%o (Sage)

%o @CachedFunction

%o def T(n, k):

%o if (k==0): return 1

%o elif (k==1): return n

%o else: return (n-k+1)*T(n+1, k-1) - (k-1)*(n+1)*T(n+2, k-2)

%o [T(1, n) for n in (0..25)] # _G. C. Greubel_, Jan 29 2020

%Y A column of A105937.

%K sign

%O 0,3

%A Vincent v.d. Noort, Mar 21 2007