cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A235378 a(n) = (-1)^n*(n! - (-1)^n).

Original entry on oeis.org

-2, 1, -7, 23, -121, 719, -5041, 40319, -362881, 3628799, -39916801, 479001599, -6227020801, 87178291199, -1307674368001, 20922789887999, -355687428096001, 6402373705727999, -121645100408832001, 2432902008176639999, -51090942171709440001, 1124000727777607679999
Offset: 1

Views

Author

Jean-François Alcover, Jan 08 2014

Keywords

Comments

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

Crossrefs

Cf. A000240.

Programs

  • Magma
    [(-1)^n*(Factorial(n) - (-1)^n): n in [1..30]]; // G. C. Greubel, Nov 21 2017
  • Mathematica
    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}]
    (* or, simply: *) Table[(-1)^n*(n!-(-1)^n), {n, 1, 25}]
    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 *)
  • PARI
    for(n=1, 30, print1((-1)^n*(n!-(-1)^n), ", ")) \\ G. C. Greubel, Nov 21 2017
    

Formula

Recurrence: a(1)=-2, a(2)=1; for n>2, a(n) = -n*a(n-1) - n - 1.
E.g.f.: 1/(1+x) - exp(x).
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
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