OFFSET
1,2
COMMENTS
a(n+2) - a(n) = 3*(n-1)*(n-1)! = A052673(n).
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..250
FORMULA
a(n) = 2*(-1)^n - 3*(-1)^n*Sum_{k=0..n-1} (-1)^k*k!. - Vaclav Kotesovec, Oct 28 2012
MATHEMATICA
RecurrenceTable[{a[1]==1, a[2]==2, a[n]==a[n-1](n-2)+a[n-2](n-1)}, a, {n, 20}] (* Harvey P. Dale, Nov 02 2011 *)
Table[2*(-1)^n-3*(-1)^n*Sum[(-1)^k*k!, {k, 0, n-1}], {n, 1, 20}] (* Vaclav Kotesovec, Oct 28 2012 *)
PROG
(Haskell)
a122972 n = a122972_list !! (n-1)
a122972_list = 1 : 2 : zipWith (+)
(zipWith (*) [2..] a122972_list) (zipWith (*) [1..] $ tail a122972_list)
-- Reinhard Zumkeller, Nov 15 2011
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Sep 21 2006
STATUS
approved