%I #49 Feb 07 2022 00:15:39
%S 1,1,3,9,31,129,651,3913,27399,219201,1972819,19728201,217010223,
%T 2604122689,33853594971,473950329609,7109254944151,113748079106433,
%U 1933717344809379,34806912206568841,661331331924807999,13226626638496160001,277759159408419360043
%N a(0) = 1; a(n) = (n-1)*a(n-1) + n.
%C From _Frank Ruskey_, Nov 24 2009: (Start)
%C If the initial 1 were deleted, the recurrence relation becomes a(n) = n+1+n*a(n-1) with a(0) = 1. Furthermore, it can then be shown that a(n) is the number of nonempty subsets of binary strings with n 1's and 2 0's that are closed under the operation of replacing the leftmost 01 with 10. Taking the maximal elements under this relation,
%C a(2) = 9 = |{0011},{0101},{1001},{1010},{1100},{0110}, {0110,1001},{0101,0110},{0011,0110}|.
%C We also have the e.g.f. (1+x)/(1-x) e^x and the formula a(n) = -1 + 2*n!*sum_{j=0..n} 1/j!. (End)
%C a(n+1) = sum of n-th row in triangle A245334. - _Reinhard Zumkeller_, Aug 30 2014 [A-number corrected by _N. J. A. Sloane_, May 03 2017]
%C Eigensequence of triangle with (1, 2, 3, ...) as the right and left borders and the rest zeros. - _Gary W. Adamson_, Aug 01 2016
%C The following remarks apply to the sequence without the initial term a(0) = 1: For k = 2,3,4,... the difference a(n+k) - a(n) is divisible by k. It follows that for each k the sequence a(n) taken modulo k is periodic with period dividing k. For example, modulo 10 the sequence becomes 1, 3, 9, 1, 9, 1, 3, 9, 1, 9, ... with period 5. Cf. A000522. - _Peter Bala_, Nov 19 2017
%D F. Drewes et al., Tight Bounds for Cut-Operations on Deterministic Finite Automata, in Lecture Notes in Computer Science, Volume 9288 2015, Machines, Computations, and Universality, 7th International Conference, MCU 2015, Famagusta, North Cyprus, September 9-11, 2015, Editors: Jerome Durand-Lose, Benedek Nagy, ISBN: 978-3-319-23110-5 (Print) 978-3-319-23111-2 (Online). ["In the On-Line Encyclopedia of Integer Sequences (OEIS) this matches the sequence A111063."]
%H Reinhard Zumkeller, <a href="/A111063/b111063.txt">Table of n, a(n) for n = 0..400</a>
%F a(n+1) = Sum_{k=0..2*n} C(n,floor(k/2))(n-floor(k/2))!. - _Paul Barry_, May 04 2007
%F a(n) = A030297(n)/n, n>0.
%F a(n) = A007526(n) + A000522(n). - _Gary Detlefs_, Jun 10 2010
%F a(n) = 2*floor(e*n!) - 1, n>1. - _Gary Detlefs_, Jun 10 2010
%F E.g.f.: exp(x)*(1+x)/(1-x), - _N. J. A. Sloane_, May 03 2017
%F a(n) ~ 2*sqrt(2*Pi)*exp(1)*n^n*sqrt(n)/exp(n). - _Ilya Gutkovskiy_, Aug 02 2016
%F a(n) = 2*exp(1)*GAMMA(n, 1) - 1 for n>=1. - _Peter Luschny_, Nov 21 2017
%p a:=proc(n) option remember; if n=0 then RETURN(1); fi; (n-1)*a(n-1)+n; end;
%p # Alternatively:
%p a := n -> `if`(n=0, 1, 2*exp(1)*GAMMA(n, 1) - 1):
%p seq(simplify(a(n)), n=0..22); # _Peter Luschny_, Nov 21 2017
%t FoldList[#1*#2 + #2 + 1 &, 1, Range[21]] (* _Robert G. Wilson v_, Jul 07 2012 *)
%o (Haskell)
%o a111063 n = a111063_list !! n
%o a111063_list = 1 : zipWith (+) [1..] (zipWith (*) [0..] a111063_list)
%o -- _Reinhard Zumkeller_, Aug 30 2014
%Y Cf. A000522, A007526, A030297, A245334, A240993.
%K nonn,easy
%O 0,3
%A _N. J. A. Sloane_, Oct 08 2005