OFFSET
0,1
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..200
INRIA Algorithms Project, Encyclopedia of Combinatorial Structures 874
FORMULA
E.g.f.: (-2-exp(x)+x*exp(x))/(-1+x).
Recurrence: {a(2)=5, a(1)=3, (n^2+2*n+1)*a(n)+(-n^2-3*n-1)*a(n+1)+a(n+2)*n}
From Sergei N. Gladkovskii, Jul 04 2012: (Start)
a(0)=3; for n>0, a(n) = n*a(n-1)-n+1.
Let E(x) be the e.g.f., then
E(x)=(x*G(0)-2)/(x-1), where G(k)= 1 - 1/(x - x^3/(x^2 - (k+1)/G(k+1)));(continued fraction, 3rd kind, 3-step).
E(x)=x*G(0)/(x-1), where G(k)= 1 - 1/(x + 2*x*(x-1)*k!/(1 - 2*(x-1)*k! - x^2/(x^2 + 2*(x-1)*(k+1)!/G(k+1)))); (continued fraction, 3rd kind, 4-step).
(End).
MAPLE
spec := [S, {S=Union(Sequence(Z), Sequence(Z), Set(Z))}, labeled]: seq(combstruct[count](spec, size=n), n=0..20);
a[0]:=3: for n from 1 to 21 do a[n]:=n*a[n-1]-n+1; od:
seq(a[n], n=0..20). # Sergei N. Gladkovskii, Jul 04 2012
MATHEMATICA
lst={}; s=-3; Do[s+=(n+=s*n); AppendTo[lst, s], {n, 0, 5!}]; lst (* Vladimir Joseph Stephan Orlovsky, Oct 10 2008 *)
FoldList[#1*#2 - #2 + 1 &, 3, Range[19]] (* Robert G. Wilson v, Jul 07 2012 *)
Table[2 n! + 1, {n, 0, 20}] (* Vincenzo Librandi, Sep 29 2013 *)
PROG
(Magma) [2*Factorial(n) + 1: n in [0..20]]; /* or */ [3] cat [n eq 1 select n+2 else n*Self(n-1)-n+1: n in [1..25] ]; // Vincenzo Librandi, Sep 29 2013
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
encyclopedia(AT)pommard.inria.fr, Jan 25 2000
EXTENSIONS
Definition replaced with the closed formula by Bruno Berselli, Sep 28 2013
STATUS
approved