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 #17 Sep 08 2022 08:46:24
%S 1,2,2,0,-4,-4,12,32,-40,-264,56,2432,1872,-24880,-47344,276096,
%T 938912,-3202528,-18225120,36217856,364270016,-323869248,-7609269568,
%U -808015360,166595915136,185180268416,-3813121694848,-8442628405248,90698535660800,318649502602496,-2220909495899904
%N a(n) = a(n-1) - (n-2)*a(n-2), with a(0)=1, a(1)=2.
%C Former title and formula of A122033, but not the data.
%H G. C. Greubel, <a href="/A328141/b328141.txt">Table of n, a(n) for n = 0..800</a>
%F a(n) = a(n-1) - (n-2)*a(n-2), with a(0)=1, a(1)=2.
%F E.g.f.: 1 + sqrt(2*e*Pi)*( erf(1/sqrt(2)) + erf((x-1)/sqrt(2)) ), where erf(x) is the error function.
%F a(n) = 2*(-1)^(n-1)*A001464(n-1).
%F a(n) = 2*(1/sqrt(2))^(n-1) * Hermite(n-1, 1/sqrt(2)), n > 0.
%p a:= proc (n) option remember;
%p if n < 2 then n+1
%p else a(n-1) - (n-2)*a(n-2)
%p fi;
%p end proc; seq(a(n), n = 0..35);
%t a[n_]:= a[n]= If[n<2, n+1, a[n-1]-(n-2)*a[n-2]]; Table[a[n], {n,0,35}]
%o (PARI) my(m=35, v=concat([1,2], vector(m-2))); for(n=3, m, v[n] = v[n-1] - (n-3)*v[n-2] ); v
%o (Magma) I:=[1,2]; [n le 2 select I[n] else Self(n-1) - (n-3)*Self(n-2): n in [1..35]];
%o (Sage)
%o def a(n):
%o if n<2: return n+1
%o else: return a(n-1) - (n-2)*a(n-2)
%o [a(n) for n in (0..35)]
%o (GAP) a:=[1,2];; for n in [3..35] do a[n]:=a[n-1]-(n-3)*a[n-2]; od; a;
%Y Cf. A001464, A060821, A121966, A122033.
%K sign
%O 0,2
%A _G. C. Greubel_, Oct 04 2019