login
a(n) = n*(n-1)*a(n-1)/2 + a(n-2), a(0) = a(1) = 1.
(Formerly M1811 N0717)
3

%I M1811 N0717 #36 Sep 08 2022 08:44:28

%S 1,1,2,7,44,447,6749,142176,3987677,143698548,6470422337,356016927083,

%T 23503587609815,1833635850492653,166884365982441238,

%U 17524692064006822643,2103129932046801158398,286043195450428964364771,43766712033847678348968361

%N a(n) = n*(n-1)*a(n-1)/2 + a(n-2), a(0) = a(1) = 1.

%D N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).

%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

%H T. D. Noe, <a href="/A001046/b001046.txt">Table of n, a(n) for n = 0..100</a>

%H R. K. Guy, <a href="/A002186/a002186.pdf">Letters to N. J. A. Sloane, June-August 1968</a>

%e a(4) = 4*3*7/2 + 2 = 44.

%p a := proc (n) option remember;

%p if n < 2 then 1

%p else binomial(n,2)*a(n-1)+a(n-2) fi;

%p end proc;

%p seq(a(n), n = 0..20); # _G. C. Greubel_, Sep 20 2019

%t RecurrenceTable[{a[0]==a[1]==1,a[n]==n(n-1) a[n-1]/2+a[n-2]}, a[n], {n,20}] (* _Harvey P. Dale_, Sep 07 2011 *)

%t t = {1, 1}; Do[AppendTo[t, n*(n-1)*t[[-1]]/2 + t[[-2]]], {n, 2, 20}] (* _T. D. Noe_, Jun 25 2012 *)

%o (PARI) m=20; v=concat([1,1], vector(m-2)); for(n=3, m, v[n]=binomial(n-1, 2)*v[n-1] + v[n-2] ); v \\ _G. C. Greubel_, Sep 20 2019

%o (Magma) I:=[1,1]; [n le 2 select I[n] else Binomial(n-1,2)*Self(n-1) + Self(n-2): n in [1..20]]; // _G. C. Greubel_, Sep 20 2019

%o (Sage)

%o def a(n):

%o if (n<2): return 1

%o else: return binomial(n,2)*a(n-1)+a(n-2)

%o [a(n) for n in (0..20)] # _G. C. Greubel_, Sep 20 2019

%o (GAP) a:=[1,1];; for n in [3..20] do a[n]:=Binomial(n-1,2)*a[n-1]+a[n-2]; od; a; # _G. C. Greubel_, Sep 20 2019

%Y Cf. A001052.

%K nonn,easy

%O 0,3

%A _N. J. A. Sloane_

%E More terms from _James A. Sellers_, Oct 05 2000