cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A003417 Continued fraction for e.

This page as a plain text file.
%I A003417 M0088 #192 May 04 2025 01:58:44
%S A003417 2,1,2,1,1,4,1,1,6,1,1,8,1,1,10,1,1,12,1,1,14,1,1,16,1,1,18,1,1,20,1,
%T A003417 1,22,1,1,24,1,1,26,1,1,28,1,1,30,1,1,32,1,1,34,1,1,36,1,1,38,1,1,40,
%U A003417 1,1,42,1,1,44,1,1,46,1,1,48,1,1,50,1,1,52,1,1,54,1,1,56,1,1,58,1,1,60,1,1,62,1,1,64,1,1,66
%N A003417 Continued fraction for e.
%C A003417 This is also the Engel expansion for 3*exp(1/2)/2 - 1/2. - _Gerald McGarvey_, Aug 07 2004
%C A003417 Sorted with duplicate terms dropped, this is A004277, 1 together with the positive even numbers. - _Alonso del Arte_, Jan 27 2012
%C A003417 From _Peter Bala_, Nov 26 2019: (Start)
%C A003417 Related continued fractions expansions:
%C A003417 2*e = [5; 2, 3, 2, 3, 1, 2, 1, 3, 4, 3, 1, 4, 1, 3, 6, 3, 1, 6, ..., 1, 3, 2*n, 3, 1, 2*n, ...].
%C A003417 (1/2)*e = [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, 2*n + 1, 3, 1, 2*n + 1, ...].
%C A003417 4*e = [10, 1, 6, 1, 7, 2, 7, 2, 7, 1, 1, 1, 7, 3, 7, 1, 2, 1, 7, 4, 7, 1, 3, 1, 7, 5, 7, 1, 4, ..., 1, 7, n+1, 7, 1, n, ...].
%C A003417 (1/4)*e = [0, 1, 2, 8, 3, 1, 1, 1, 1, 7, 1, 1, 2, 1, 1, 1, 2, 7, 1, 2, 2, 1, 1, 1, 3, 7, 1, 3, 2, 1, 1, 1, 4, 7, 1, 4, 2, ..., 1, 1, 1, n, 7, 1, n, 2, ...]. (End)
%D A003417 John H. Conway and Richard K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996. See p. 186.
%D A003417 CRC Standard Mathematical Tables and Formulae, 30th ed. 1996, p. 88.
%D A003417 Steven R. Finch, Mathematical Constants, Cambridge, 2003, Section 1.3.2.
%D A003417 Jay R. Goldman, The Queen of Mathematics, 1998, p. 70.
%D A003417 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A003417 N. J. A. Sloane, <a href="/A003417/b003417.txt">Table of n, a(n) for n = 0..9999</a>
%H A003417 Khalil Ayadi, Chiheb Ben Bechir, and Maher Saadaoui, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL28/Ayadi/ayadi12.html">Continued Fractions with Predictable Patterns and Transcendental Numbers</a>, J. Int. Seq. (2025) Vol. 28, Art. No. 25.1.4.
%H A003417 Thomas Baruchel and Carsten Elsner, <a href="https://arxiv.org/abs/1602.06445">On error sums formed by rational approximations with split denominators</a>, arXiv preprint arXiv:1602.06445 [math.NT], 2016.
%H A003417 Henry Cohn, A short proof of the simple continued fraction expansion of e, Amer. Math. Monthly, 113 (No. 1, 2006), 57-62. <a href="http://www.jstor.org/stable/27641837">[JSTOR]</a> and <a href="http://arxiv.org/abs/math/0601660">arXiv:math/0601660 [math.NT]</a>, 2006.
%H A003417 Stephen Crowley, <a href="https://web.archive.org/web/20120610012850/http://vixra.org/abs/1202.0079">Integral Transforms of the Harmonic Sawtooth Map, The Riemann Zeta Function, and Fractal Strings</a>, vixra:1202.0079 v2, 2012. [Wayback Machine link]
%H A003417 Francesco Dolce and Pierre-Adrien Tahay, <a href="https://www.irif.fr/~dolce/papers/dlt22.pdf">Column representation of Sturmian words in cellular automata</a>, Czech Technical University (Prague, Czechia, 2022).
%H A003417 W. R. Harmon, <a href="/A003417/a003417.pdf">Letter to N. J. A. Sloane, Sep 1974</a>
%H A003417 MathOverflow, <a href="https://mathoverflow.net/questions/128676/what-is-the-effect-of-adding-1-2-to-a-continued-fraction">What is the effect of adding 1/2 to a continued fraction?</a>, 2013.
%H A003417 Keith Matthews, <a href="http://www.numbertheory.org/php/davison.html">Finding the continued fraction of e^(l/m)</a>
%H A003417 Sophie Morier-Genoud and Valentin Ovsienko, <a href="https://arxiv.org/abs/1908.04365">On q-deformed real numbers</a>, arXiv:1908.04365 [math.QA], 2019.
%H A003417 C. D. Olds, <a href="http://www.jstor.org/stable/2318113">The simple continued fraction expansion of e</a>, Am. Math. Monthly 77 (9) (1970) 968-974.
%H A003417 Thomas J. Osler, <a href="http://www.jstor.org/stable/27641838">A proof of the continued fraction expansion of e^(1/M)</a>, Amer. Math. Monthly, 113 (No. 1, 2006), 62-66.
%H A003417 Oskar Perron, <a href="https://archive.org/details/dielehrevondenk00perrgoog/page/134/mode/1up?view=theater">Die Lehre von den Kettenbrüchen</a>, 2nd ed., Teubner, Leipzig, 1929, p. 134.
%H A003417 Simon Plouffe, <a href="https://arxiv.org/abs/0911.4975">Approximations de séries génératrices et quelques conjectures</a>, Dissertation, Université du Québec à Montréal, 1992; arXiv:0911.4975 [math.NT], 2009.
%H A003417 Simon Plouffe, <a href="/A000051/a000051_2.pdf">1031 Generating Functions</a>, Appendix to Thesis, Montreal, 1992.
%H A003417 Ward Whitt, Weirdness in CTMC's, Notes for Course IEOR 6711: Stochastic Models I, <a href="http://www.columbia.edu/~ww2040/6711F12/lect1129.pdf">[PDF]</a>, 2012. - From _N. J. A. Sloane_, Jan 03 2013
%H A003417 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/eContinuedFraction.html">e Continued Fraction</a>.
%H A003417 Gang Xiao, <a href="http://wims.unice.fr/~wims/en_tool~number~contfrac.en.html">Contfrac</a>.
%H A003417 Yaohui Zhu, Kaiming Sun, Zhengdong Luo, and Lingfeng Wang, <a href="https://doi.org/10.1609/aaai.v39i2.32162">Progressive Self-Learning for Domain Adaptation on Symbolic Regression of Integer Sequences</a>, Proc. 39th AAAI Conf. Artif. Intel. (2025) Vol. 39, No. 1, 1692-1699. See p. 1698.
%H A003417 <a href="/index/Con#confC">Index entries for continued fractions for constants</a>.
%H A003417 <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,2,0,0,-1).
%F A003417 From _Paul Barry_, Jun 27 2006: (Start)
%F A003417 G.f.: (2 + x + 2*x^2 - 3*x^3 - x^4 + x^6)/(1 - 2*x^3 + x^6).
%F A003417 a(n) = 0^n + Sum{k = 0..n} 2*sin(2*Pi*(k - 1)/3)*floor((2*k - 1)/3)/sqrt(3). [Corrected and simplified by _Jianing Song_, Jan 05 2019] (End)
%F A003417 a(n) = 2*a(n-3) - a(n-6), n >= 7. - _Philippe Deléham_, Feb 10 2009
%F A003417 G.f.: 1 + U(0) where U(k)= 1 + x/(1 - x*(2*k + 1)/(1 + x*(2*k + 1) - 1/((2*k + 1) + 1 - (2*k + 1)*x/(x + 1/U(k+1))))); (continued fraction, 5-step). - _Sergei N. Gladkovskii_, Oct 07 2012
%F A003417 a(3*n-1) = 2*n, a(0) = 2, a(n) = 1 otherwise (i.e., for n+1 > 1, not a multiple of 3). - _M. F. Hasler_, May 01 2013
%F A003417 E.g.f.: First derivative of (2/9)*exp(x)*(x + 3) + (2/9)*exp(-x/2)*(2*x*cos((sqrt(3)/2)*x+2*Pi/3) - 3*cos((sqrt(3)/2)*x)) + x. - _Jianing Song_, Jan 05 2019
%F A003417 a(n) = floor(1/(n+1))-(floor(n/3)-floor((n+1)/3))*(2*n-1)/3+1. - _Aaron J Grech_, Sep 06 2024
%F A003417 Sum_{n>=1} (-1)^(n+1)/a(n) = 1 - log(2)/2. - _Amiram Eldar_, May 03 2025
%e A003417 2.718281828459... = 2 + 1/(1 + 1/(2 + 1/(1 + 1/(1 + ...))))
%p A003417 numtheory[cfrac](exp(1),100,'quotients'); # _Jani Melik_, May 25 2006
%p A003417 A003417:=(2+z+2*z**2-3*z**3-z**4+z**6)/(z-1)**2/(z**2+z+1)**2; # _Simon Plouffe_ in his 1992 dissertation
%t A003417 ContinuedFraction[E, 100] (* _Stefan Steinerberger_, Apr 07 2006 *)
%t A003417 a[n_] := KroneckerDelta[1, n] + 2 n/3 - (2 n - 3)/3 DirichletCharacter[3, 1, n]; Table[a[n], {n, 1, 20}] (* _Enrique Pérez Herrero_, Feb 23 2013 *)
%t A003417 Table[Piecewise[{{2, n == 0}, {2 (n + 1)/3, Mod[n, 3] == 2}}, 1], {n, 0, 120}] (* _Eric W. Weisstein_, Jan 05 2019 *)
%t A003417 Join[{2}, LinearRecurrence[{0, 0, 2, 0, 0, -1}, {1, 2, 1, 1, 4, 1}, 120]] (* _Eric W. Weisstein_, Jan 05 2019 *)
%t A003417 Join[{2}, Table[(2 (n + 4) + (1 - 2 n) Cos[2 n Pi/3] + Sqrt[3] (1 - 2 n) Sin[2 n Pi/3])/9, {n, 120}]] (* _Eric W. Weisstein_, Jan 05 2019 *)
%t A003417 Join[{2}, Flatten[Table[{1, 2n, 1}, {n, 40}]]] (* _Harvey P. Dale_, Jan 21 2020 *)
%o A003417 (PARI) contfrac(exp(1)) \\ _Alexander R. Povolotsky_, Feb 23 2008
%o A003417 (PARI) { allocatemem(932245000); default(realprecision, 25000); x=contfrac(exp(1)); for (n=1, 10000, write("b003417.txt", n-1, " ", x[n])); } \\ _Harry J. Smith_, Apr 14 2009
%o A003417 (PARI) A003417(n)=if(n%3<>2,1+(n==0),(n+1)/3*2) \\ _M. F. Hasler_, May 01 2013
%o A003417 (Scala) def eContFracTrio(n: Int): List[Int] = List(1, 2 * n, 1)
%o A003417 2 +: ((1 to 40).map(eContFracTrio).flatten) // _Alonso del Arte_, Nov 22 2020, with thanks to _Harvey P. Dale_
%o A003417 (Python)
%o A003417 def A003417(n): return 2 if n == 0 else 1 if n % 3 != 2 else (n+1)//3<<1 # _Chai Wah Wu_, Jul 27 2022
%Y A003417 Cf. A001113, A007676, A007677, A001204, A058282, A005131.
%Y A003417 Cf. A006083, A006084, A006085, A081750.
%Y A003417 Run lengths of A342991.
%K A003417 nonn,cofr,nice,easy
%O A003417 0,1
%A A003417 _N. J. A. Sloane_
%E A003417 Offset changed by _Andrew Howroyd_, Aug 07 2024