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 #15 Sep 08 2022 08:45:41
%S 1,2,6,28,170,1252,10774,105764,1164298,14188468,189461222,2749300084,
%T 43058394154,723619035908,12984464393398,247704600763972,
%U 5005042735932554,106759075226130004,2396869357456172038,56491095210068416148,1394373970361058540202
%N a(0)=1; a(1)=2; a(2)=6; a(n+1) = 2*(n+1)*a(n) - n^2*a(n-1), n > 1.
%H G. C. Greubel, <a href="/A156626/b156626.txt">Table of n, a(n) for n = 0..442</a>
%p A156626 := proc(n)
%p if n<=1 then
%p n+1 ;
%p elif n = 2 then
%p 6 ;
%p else
%p 2*n*procname(n-1)-(n-1)^2*procname(n-2) ;
%p end if;
%p end proc:
%p seq(A156626(n),n=0..20) ; # _R. J. Mathar_, Sep 27 2011
%t Join[{1}, RecurrenceTable[{a[n] == 2*n*a[n-1] - (n-1)^2*a[n-2], a[1] == 2, a[2] == 6}, a, {n,1,50}]] (* _G. C. Greubel_, Sep 01 2018 *)
%o (PARI) m=30; v=concat([2,6], vector(m-2)); for(n=3, m, v[n] = 2*n*v[n-1]-(n-1)^2*v[n-2]); concat([1], v) \\ _G. C. Greubel_, Sep 01 2018
%o (Magma) I:=[2, 6]; [1] cat [n le 2 select I[n] else 2*n*Self(n-1) - (n-1)^2*Self(n-2): n in [1..30]]; // _G. C. Greubel_, Sep 01 2018
%Y Cf. A001620, A002720.
%K easy,nonn
%O 0,2
%A _Jonathan Vos Post_, Feb 12 2009