login
A110043
a(0) = 1, a(1) = 2; for n>1, a(n) = n*a(n-1) + (-1)^n.
3
1, 2, 5, 14, 57, 284, 1705, 11934, 95473, 859256, 8592561, 94518170, 1134218041, 14744834532, 206427683449, 3096415251734, 49542644027745, 842224948471664, 15160049072489953, 288040932377309106, 5760818647546182121, 120977191598469824540, 2661498215166336139881
OFFSET
0,2
COMMENTS
A000166 and A001120 have a similar recurrence.
LINKS
FORMULA
a(n) = A001120(n) + n! = A000166(n) + 2*n! for n>0.
a(n) = (n-1)*(a(n-1)+a(n-2)), n>2. - Gary Detlefs, Apr 11 2010
a(n) = 2*n! + floor((n!+1)/e) for n>0. - Gary Detlefs, Apr 11 2010
E.g.f.: (2*exp(x)*x+1)*exp(-x)/(1-x). - Alois P. Heinz, May 07 2020
MAPLE
a:= proc(n) option remember;
`if`(n<2, n+1, n*a(n-1)+(-1)^n)
end:
seq(a(n), n=0..23); # Alois P. Heinz, May 07 2020
MATHEMATICA
a[n_] := Subfactorial[n] + 2 Boole[n > 0] n!;
Table[a[n], {n, 0, 23}] (* Jean-François Alcover, Mar 18 2022 *)
CROSSREFS
Column k=2 of A334715.
Sequence in context: A047042 A174795 A243551 * A006847 A008286 A049082
KEYWORD
nonn,easy
AUTHOR
Philippe Deléham, Sep 04 2005
EXTENSIONS
a(0)=1 prepended and two terms corrected by Alois P. Heinz, May 07 2020
STATUS
approved