%I M0125 #35 May 17 2016 04:04:38
%S 1,2,1,3,1,1,1,3,3,3,1,3,1,3,5,3,1,5,1,3,7,3,1,7,1,3,9,3,1,9,1,3,11,3,
%T 1,11,1,3,13,3,1,13,1,3,15,3,1,15,1,3,17,3,1,17,1,3,19,3,1,19,1,3,21,
%U 3,1,21,1,3,23,3,1,23,1,3,25,3,1,25,1,3,27,3,1,27,1,3,29,3,1,29,1,3,31,3
%N Continued fraction for e/2.
%D D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 2, p. 601.
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H Harry J. Smith, <a href="/A006083/b006083.txt">Table of n, a(n) for n = 1..20000</a>
%H G. Xiao, <a href="http://wims.unice.fr/~wims/en_tool~number~contfrac.en.html">Contfrac</a>
%H <a href="/index/Con#confC">Index entries for continued fractions for constants</a>
%H <a href="/index/Rec#order_09">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,1,0,0,1,0,0,-1).
%F a(1)=1, a(2)=2, a(3)=1, a(4)=3, a(5)=1, a(6)=1, a(7)=1, a(8)=3, then for k>=1 a(6*k+3)=a(6*k+6)=2*k+1, a(6*k+4)=a(6*k+8)=3, a(6*k+5)=a(6*k+7)=1. - _Benoit Cloitre_, Apr 08 2003
%F From _Colin Barker_, May 16 2016: (Start)
%F a(n) = a(n-3)+a(n-6)-a(n-9) for n>9.
%F G.f.: x*(1+2*x+x^2+2*x^3-x^4-3*x^6+x^8-x^10) / ((1-x)^2*(1+x)*(1-x+x^2)*(1+x+x^2)^2).
%F (End)
%e 1.359140914229522617680143735... = 1 + 1/(2 + 1/(1 + 1/(3 + 1/(1 + ...)))). - _Harry J. Smith_, May 10 2009
%t ContinuedFraction[E/2, 94] (* _Jean-François Alcover_, Apr 01 2011 *)
%t Join[{1, 2},LinearRecurrence[{0, 0, 1, 0, 0, 1, 0, 0, -1},{1, 3, 1, 1, 1, 3, 3, 3, 1},92]] (* _Ray Chandler_, Sep 03 2015 *)
%o (PARI) { allocatemem(932245000); default(realprecision, 55000); x=contfrac(exp(1)/2); for (n=1, 20000, write("b006083.txt", n, " ", x[n])); } \\ _Harry J. Smith_, May 10 2009
%o (PARI) Vec(x*(1+2*x+x^2+2*x^3-x^4-3*x^6+x^8-x^10) / ((1-x)^2*(1+x)*(1-x+x^2)*(1+x+x^2)^2) + O(x^50)) \\ _Colin Barker_, May 16 2016
%Y Cf. A019739 = Decimal expansion. - _Harry J. Smith_, May 10 2009
%K cofr,nonn,easy
%O 1,2
%A _N. J. A. Sloane_, _Jeffrey Shallit_
%E More terms from Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Apr 20 2003