A033540 a(n+1) = n*(a(n) + 1) for n >= 1, a(1) = 1.
1, 2, 6, 21, 88, 445, 2676, 18739, 149920, 1349289, 13492900, 148421911, 1781062944, 23153818285, 324153456004, 4862301840075, 77796829441216, 1322546100500689, 23805829809012420, 452310766371235999, 9046215327424720000, 189970521875919120021
Offset: 1
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..200
- David Carlson, Sophomores meet the traveling salesperson problem, Journal of Computing Sciences in Colleges, 33(3), 126-133, 2018. See proof of the formula by Benoit Cloitre.
- N. J. A. Sloane and Brady Haran, A Sequence with a Mistake, Numberphile video (2021).
Programs
-
GAP
a:=[1,2,6];; for n in [4..30] do a[n]:=(n+1)*a[n-1]-(2*n-3)*a[n-2] +(n-3)*a[n-3]; od; a; # G. C. Greubel, Oct 13 2019
-
Magma
I:=[1,2,6]; [n le 3 select I[n] else (n+1)*Self(n-1)-(2*n-3)*Self(n-2)+(n-3)*Self(n-3): n in [1..30]]; // Vincenzo Librandi, Jun 21 2014
-
Maple
seq(coeff(series( (1+x*exp(x))/(1-x), x, n+1)*n!, x, n), n = 0..30); # G. C. Greubel, Oct 13 2019 # second Maple program: a:= proc(n) option remember; `if`(n=1, 1, (n-1)*(a(n-1)+1)) end: seq(a(n), n=1..23); # Alois P. Heinz, May 12 2021
-
Mathematica
FoldList[#1*#2 + #2 &, 1, Range[19]] (* Robert G. Wilson v, Jul 07 2012 *) nxt[{a_,n_}]:={n(a+1),n+1}; Transpose[NestList[nxt,{1,1},20]][[1]] (* Harvey P. Dale, Jun 20 2014 *)
-
PARI
my(x='x+O('x^30)); Vec(serlaplace( (1+x*exp(x))/(1-x) )) \\ G. C. Greubel, Oct 13 2019
-
Sage
[factorial(n)*( (1+x*exp(x))/(1-x) ).series(x,n+1).list()[n] for n in (0..30)] # G. C. Greubel, Oct 13 2019
Formula
a(n) = n!*(1 +1/0! +1/1! +...+ 1/(n-1)!). - Jon Bentley (jlb(AT)research.bell-labs.com)
For n>=1, a(n+1) = floor((1+e)*n!) - 1. - Benoit Cloitre, Sep 07 2002
From Vladeta Jovovic, Feb 02 2003: (Start)
a(n) = n! + A007526(n).
E.g.f.: (1+x*exp(x))/(1-x). (End)
a(n) = (n+1)*a(n-1) - (2*n-3)*a(n-2) + (n-3)*a(n-3) for n>=4. - Jaume Oliver Lafont, Sep 11 2009
a(n) = n! + floor(e*n!) - 1, n>0. - Gary Detlefs, Jun 06 2010