login
a(n) = (-1)^n*(n! - (-1)^n).
2

%I #41 Apr 11 2024 17:21:19

%S -2,1,-7,23,-121,719,-5041,40319,-362881,3628799,-39916801,479001599,

%T -6227020801,87178291199,-1307674368001,20922789887999,

%U -355687428096001,6402373705727999,-121645100408832001,2432902008176639999,-51090942171709440001,1124000727777607679999

%N a(n) = (-1)^n*(n! - (-1)^n).

%C This sequence links rencontres numbers r(n) with Sum_{k>=1} 1/((k+n)*k!) = (a(n) + (-1)^(n+1)*e*r(n))/n.

%H G. C. Greubel, <a href="/A235378/b235378.txt">Table of n, a(n) for n = 1..448</a> (terms 1..40 from Jean-François Alcover)

%H Fred Kline, <a href="http://mathoverflow.net/questions/126739">Question asked on MathOverflow: Sum_{k=0..infinity} 1/((k+2)*k!)</a>

%F Recurrence: a(1)=-2, a(2)=1; for n>2, a(n) = -n*a(n-1) - n - 1.

%F E.g.f.: 1/(1+x) - exp(x).

%F D-finite with recurrence: a(n) +(n-2)*a(n-1) +(-2*n+3)*a(n-2) +(n-2)*a(n-3)=0. - _R. J. Mathar_, Feb 24 2020

%F a(1) = -2; For a > 1: a(n) = (-1)^n*Sum_{j=0..n-1} (abs(Stirling1(n,j) + binomial(n - 1, j))). - _Detlef Meya_, Apr 11 2024

%t r[n_] := n*Subfactorial[n-1]; a[n_] := n*Sum[1/((k + n)*k!), {k, 1, Infinity}] + (-1)^n*E*r[n]; Table[a[n], {n, 1, 25}]

%t (* or, simply: *) Table[(-1)^n*(n!-(-1)^n), {n, 1, 25}]

%t a[1]:=-2;a[n]:=(-1)^n*Sum[Abs[StirlingS1[n,j]+Binomial[n-1,j]],{j,0,n-1}];Flatten[Table[a[n],{n,1,19}]] (* _Detlef Meya_, Apr 11 2024 *)

%o (PARI) for(n=1, 30, print1((-1)^n*(n!-(-1)^n), ", ")) \\ _G. C. Greubel_, Nov 21 2017

%o (Magma) [(-1)^n*(Factorial(n) - (-1)^n): n in [1..30]]; // _G. C. Greubel_, Nov 21 2017

%Y Cf. A000240.

%K sign,easy

%O 1,1

%A _Jean-François Alcover_, Jan 08 2014