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.

Showing 1-3 of 3 results.

A003417 Continued fraction for e.

Original entry on oeis.org

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, 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, 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
Offset: 0

Views

Author

Keywords

Comments

This is also the Engel expansion for 3*exp(1/2)/2 - 1/2. - Gerald McGarvey, Aug 07 2004
Sorted with duplicate terms dropped, this is A004277, 1 together with the positive even numbers. - Alonso del Arte, Jan 27 2012
From Peter Bala, Nov 26 2019: (Start)
Related continued fractions expansions:
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, ...].
(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, ...].
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, ...].
(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)

Examples

			2.718281828459... = 2 + 1/(1 + 1/(2 + 1/(1 + 1/(1 + ...))))
		

References

  • John H. Conway and Richard K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996. See p. 186.
  • CRC Standard Mathematical Tables and Formulae, 30th ed. 1996, p. 88.
  • Steven R. Finch, Mathematical Constants, Cambridge, 2003, Section 1.3.2.
  • Jay R. Goldman, The Queen of Mathematics, 1998, p. 70.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Maple
    numtheory[cfrac](exp(1),100,'quotients'); # Jani Melik, May 25 2006
    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
  • Mathematica
    ContinuedFraction[E, 100] (* Stefan Steinerberger, Apr 07 2006 *)
    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 *)
    Table[Piecewise[{{2, n == 0}, {2 (n + 1)/3, Mod[n, 3] == 2}}, 1], {n, 0, 120}] (* Eric W. Weisstein, Jan 05 2019 *)
    Join[{2}, LinearRecurrence[{0, 0, 2, 0, 0, -1}, {1, 2, 1, 1, 4, 1}, 120]] (* Eric W. Weisstein, Jan 05 2019 *)
    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 *)
    Join[{2}, Flatten[Table[{1, 2n, 1}, {n, 40}]]] (* Harvey P. Dale, Jan 21 2020 *)
  • PARI
    contfrac(exp(1)) \\ Alexander R. Povolotsky, Feb 23 2008
    
  • 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
    
  • PARI
    A003417(n)=if(n%3<>2,1+(n==0),(n+1)/3*2) \\ M. F. Hasler, May 01 2013
    
  • Python
    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
  • Scala
    def eContFracTrio(n: Int): List[Int] = List(1, 2 * n, 1)
    2 +: ((1 to 40).map(eContFracTrio).flatten) // Alonso del Arte, Nov 22 2020, with thanks to Harvey P. Dale
    

Formula

From Paul Barry, Jun 27 2006: (Start)
G.f.: (2 + x + 2*x^2 - 3*x^3 - x^4 + x^6)/(1 - 2*x^3 + x^6).
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)
a(n) = 2*a(n-3) - a(n-6), n >= 7. - Philippe Deléham, Feb 10 2009
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
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
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
a(n) = floor(1/(n+1))-(floor(n/3)-floor((n+1)/3))*(2*n-1)/3+1. - Aaron J Grech, Sep 06 2024
Sum_{n>=1} (-1)^(n+1)/a(n) = 1 - log(2)/2. - Amiram Eldar, May 03 2025

Extensions

Offset changed by Andrew Howroyd, Aug 07 2024

A001204 Continued fraction for e^2.

Original entry on oeis.org

7, 2, 1, 1, 3, 18, 5, 1, 1, 6, 30, 8, 1, 1, 9, 42, 11, 1, 1, 12, 54, 14, 1, 1, 15, 66, 17, 1, 1, 18, 78, 20, 1, 1, 21, 90, 23, 1, 1, 24, 102, 26, 1, 1, 27, 114, 29, 1, 1, 30, 126, 32, 1, 1, 33, 138, 35, 1, 1, 36, 150, 38, 1, 1, 39, 162, 41, 1, 1, 42, 174, 44, 1, 1, 45, 186, 47, 1, 1
Offset: 0

Views

Author

Keywords

Comments

Note that e^2 = 7 + 2/(5 + 1/(7 + 1/(9 + 1/(11 + ...)))) (follows from the fact that A004273 is the continued fraction expansion of tanh(1) = (e^2 - 1)/(e^2 + 1)). - Peter Bala, Jan 15 2022

Examples

			7.389056098930650227230427460... = 7 + 1/(2 + 1/(1 + 1/(1 + 1/(3 + ...)))).
		

References

  • Oskar Perron, Die Lehre von den Kettenbrüchen, 2nd ed., Teubner, Leipzig, 1929, p. 138.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Mathematica
    ContinuedFraction[ E^2, 100]
    LinearRecurrence[{0,0,0,0,2,0,0,0,0,-1},{7,2,1,1,3,18,5,1,1,6,30},80] (* Harvey P. Dale, Dec 30 2023 *)
  • PARI
    contfrac(exp(2))
    
  • PARI
    allocatemem(932245000); default(realprecision, 95000); x=contfrac(exp(2)); for (n=1, 20001, write("b001204.txt", n-1, " ", x[n])); \\ Harry J. Smith, Apr 30 2009

Formula

G.f.: (x^10 - x^8 - x^7 + x^6 + 4x^5 + 3x^4 + x^3 + x^2 + 2x + 7)/(x^5 - 1)^2. - Ralf Stephan, Mar 23 2003
For n > 0, a(5n) = 12n + 6, a(5n+1) = 3n + 2, a(5n+2) = a(5n+3) = 1 and a(5n+4) = 3n + 3. - Dean Hickerson, Mar 25 2003
Sum_{n>=5} (-1)^(n+1)/a(n) = (8*sqrt(3)-3)*Pi/72 - 2*log(2)/3. - Amiram Eldar, May 04 2025

Extensions

More terms from Robert G. Wilson v, Dec 07 2000

A249328 Position where n occurs first in the continued fraction expansion of e^3.

Original entry on oeis.org

2, 3, 5, 4, 7, 18, 32, 91, 142, 454, 1, 245, 15, 16, 126, 10, 304, 74, 202, 0, 296, 409, 227, 89, 865, 425, 183, 384, 616, 634, 1200, 1467, 1226, 159, 233, 2023, 584, 1384, 745, 764, 770, 329, 1582, 1721, 585, 85, 392, 136, 3984, 740, 302, 890
Offset: 1

Views

Author

Ralf Stephan, Jan 12 2015

Keywords

Crossrefs

Cf. A058282.

Programs

  • Sage
    l = continued_fraction(exp(3))[:10000]
    [next((i for i, x in enumerate(l) if x == n), None) for n in range(1,100)]
Showing 1-3 of 3 results.