login
A106539
a(1)=1, a(2)=1, a(n) = (n-1)*a(n-1) - (n-2)*a(n-2) - ... - a(1) for n>=3.
1
1, 1, 1, 0, -6, -36, -192, -1104, -7248, -54816, -472512, -4573824, -49064448, -577130496, -7381281792, -101940854784, -1511556077568, -23945902043136, -403579232182272, -7209532170092544, -136064164749017088, -2705030337674674176, -56501002847058788352
OFFSET
1,5
COMMENTS
Beginning with a(0)=0, a(1)=1 gives 0, 1, 2, 4, 8, 16, ..., 2^(n-1).
LINKS
FORMULA
D-finite with recurrence: a(n) = n*a(n-1) - 2*(n-2)*a(n-2), a(1)=1, a(2)=1. - Georg Fischer, Jun 18 2021
a(n) = e^(-2)*( - Gamma(n)*E_{n}(-2) + 2^(n-1)*(-Ei(2) + e^2 - Pi*i), where Ei(x) and E_{n}(x) are exponential integrals. - G. C. Greubel, Sep 03 2021
EXAMPLE
a(7) = 6*(-36) - 5(-6) - 4*0 - 3*1 - 2*1 - 1*1 = -216 + 30 - 0 - 3 - 2 - 1 = -192.
MAPLE
nmax:=24; a[1]:=1: a[2]:=1: for n from 3 to nmax do a[n]:=(n-1)*a[n-1]-add(k*a[k], k=1..n-2) od: seq(a[n], n=1..nmax); # Emeric Deutsch, Feb 03 2006
MATHEMATICA
RecurrenceTable[{a[n]==n*a[n-1] - 2*(n-2)*a[n-2], a[1]==a[2]==1}, a[n], {n, 1, 20}] (* Georg Fischer, Jun 18 2021 *)
PROG
(Magma) [n le 2 select 1 else n*Self(n-1) - 2*(n-2)*Self(n-2): n in [1..30]]; // G. C. Greubel, Sep 03 2021
(Sage)
def a(n): return 1 if (n<3) else n*a(n-1) - 2*(n-2)*a(n-2)
[a(n) for n in (1..30)] # G. C. Greubel, Sep 03 2021
CROSSREFS
Cf. A001571.
Sequence in context: A209904 A146883 A159721 * A215453 A267229 A048980
KEYWORD
easy,sign
AUTHOR
Alexandre Wajnberg, May 08 2005
EXTENSIONS
More terms from Emeric Deutsch, Feb 03 2006
Definition adapted to offset by Georg Fischer, Jun 18 2021
STATUS
approved