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-8 of 8 results.

A153578 Positive terms in A133593.

Original entry on oeis.org

3, 7, 16, 3, 5, 2, 2, 2, 2, 3, 2, 15, 3, 14, 3, 2, 6, 3, 6, 9, 4, 3, 2, 9, 8, 3, 4, 4, 17, 24, 6, 4, 4, 3, 2, 9, 6, 8, 3, 4, 59, 10, 20, 4, 7, 31, 4, 3, 4, 2, 3, 3, 14, 6, 2, 3, 3, 29, 3, 3, 8, 121, 3, 25, 4, 8, 4, 2, 2, 10, 4, 13, 7, 10, 3, 2, 4, 2, 2, 3, 3, 2, 10, 4, 4, 6, 2, 8, 12, 4, 6, 5, 5, 3, 3, 4, 3
Offset: 1

Views

Author

Serhat Sevki Dincer (jfcgauss(AT)gmail.com), Dec 28 2008

Keywords

Crossrefs

A153579 Negative terms in A133593.

Original entry on oeis.org

-294, -4, -15, -3, -85, -3, -5, -2, -6, -6, -100, -2, -6, -9, -3, -3, -8, -2, -13, -5, -2, -3, -2, -5, -2, -2, -4, -162, -46, -3, -3, -3, -25, -5, -2, -10, -2, -5, -5, -6, -2, -2, -27, -2, -8, -2, -42, -3, -2, -7, -2, -4, -9, -7, -2, -4, -20, -3, -19, -3, -3, -9, -17, -4
Offset: 1

Views

Author

Serhat Sevki Dincer (jfcgauss(AT)gmail.com), Dec 28 2008

Keywords

Crossrefs

A133570 "Exact" continued fraction of e.

Original entry on oeis.org

3, -4, 2, 5, -2, -7, 2, 9, -2, -11, 2, 13, -2, -15, 2, 17, -2, -19, 2, 21, -2, -23, 2, 25, -2, -27, 2, 29, -2, -31, 2, 33, -2, -35, 2, 37, -2, -39, 2, 41, -2, -43, 2, 45, -2, -47, 2, 49, -2, -51, 2, 53, -2, -55, 2, 57, -2, -59, 2, 61, -2, -63, 2, 65, -2, -67, 2, 69, -2, -71, 2, 73, -2, -75, 2, 77, -2, -79, 2, 81, -2, -83, 2, 85, -2, -87, 2
Offset: 0

Views

Author

Serhat Sevki Dincer (jfcgauss(AT)gmail.com), Dec 30 2007

Keywords

Comments

See comments in A133593. Just as for the usual continued fraction for e, the exact continued fraction also has a simple pattern.

Crossrefs

Programs

  • Mathematica
    $MaxExtraPrecision = Infinity; x[0] = E; a[n_] := a[n] = Round[Abs[x[n]]]*Sign[x[n]]; x[n_] := 1/(x[n - 1] - a[n - 1]); Table[a[n], {n, 0, 120}] (* Clark Kimberling, Sep 04 2013 *)
    Join[{3, -4}, LinearRecurrence[{0, -2, 0, -1}, {2, 5, -2, -7}, 100]] (* Vincenzo Librandi, Jan 09 2016 *)
  • PARI
    Vec(-(x^5-5*x^4+3*x^3-8*x^2+4*x-3)/(x^2+1)^2 + O(x^100)) \\ Colin Barker, Sep 13 2013

Formula

x(0) = e, a(n) = floor( |x(n)| + 0.5 ) * Sign(x(n)), x(n+1) = 1 / (x(n)-a(n)).
From Colin Barker, Sep 13 2013 and Jan 08 2016: (Start)
a(n) = 1/2*((2-i*2)*((-i)^n-i*i^n)+((-i)^n-i^n)*n)*(-1)*i for n>1.
a(n) = -2*a(n-2)-a(n-4) for n>5.
G.f.: -(x^5-5*x^4+3*x^3-8*x^2+4*x-3)/(x^2+1)^2.
(End)

A228825 Delayed continued fraction of e.

Original entry on oeis.org

2, 2, -1, -1, -1, -2, 2, -2, 1, 1, 1, 2, -2, 2, -2, 2, -1, -1, -1, -2, 2, -2, 2, -2, 2, -2, 1, 1, 1, 2, -2, 2, -2, 2, -2, 2, -2, 2, -1, -1, -1, -2, 2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 1, 1, 1, 2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 2, -2, 2, -1, -1, -1, -2, 2, -2
Offset: 0

Views

Author

Clark Kimberling, Sep 04 2013

Keywords

Comments

An algorithm for the (usual) continued fraction of r > 0 follows: x(0) = r, a(n) = floor(x(n)), x(n+1) = 1/(x(n) - a(n)).
The accelerated continued fraction uses "round" instead of "floor" (cf. A133593, A133570, A228667), where round(x) is the integer nearest x.
The delayed continued fraction (DCF) uses "second nearest integer", so that all the terms are in {-2, -1, 1, 2}. If s/t and u/v are consecutive convergents of a DCF, then |s*x-u*t| = 1.
Regarding DCF(e), after the initial (2,2), the strings (-1,-1,-1) and (1,1,1) alternate with odd-length strings of the forms (-2,2,...,-2) and (2,-2,...,2). The string lengths form the sequence 2,3,3,3,5,3,7,3,9,3,11,3,13,3,...
Comparison of convergence rates is indicated by the following approximate values of x-e, where x is the 20th convergent: for delayed CF, x-e = 5.4x10^-7; for classical CF, x-e = 6.1x10^-16; for accelerated CF, x-e = -6.6x10^-27. The convergents for accelerated CF are a proper subset of those for classical CF, which are a proper subset of those for delayed CF (which are sampled in Example).

Examples

			Convergents: 2, 5/2, 3, 8/3, 11/4, 30/11, 49/18, 68/25, 19/7, 87/32, 106/39, 299/110, 492/181,...
		

Crossrefs

Programs

  • Mathematica
    $MaxExtraPrecision = Infinity; x[0] = E; s[x_] := s[x] = If[FractionalPart[x] < 1/2, Ceiling[x], Floor[x]]; a[n_] := a[n] = s[Abs[x[n]]]*Sign[x[n]]; x[n_] := 1/(x[n - 1] - a[n - 1]); t = Table[a[n], {n, 0, 100}]

A228935 a(n) = (3 - 6*n)*(-1)^n.

Original entry on oeis.org

0, 3, -9, 15, -21, 27, -33, 39, -45, 51, -57, 63, -69, 75, -81, 87, -93, 99, -105, 111, -117, 123, -129, 135, -141, 147, -153, 159, -165, 171, -177, 183, -189, 195, -201, 207, -213, 219, -225, 231, -237, 243, -249, 255, -261, 267, -273, 279, -285, 291
Offset: 0

Views

Author

Giovanni Artico, Oct 25 2013

Keywords

Comments

Optimal simple continued fraction (with signed denominators) of tan(1/3).
This expansion is a simple continued fraction a(0) + 1/(a(1) + 1/(a(2) + ...)) with all numerators 1, and the numbers a(n) are signed integers computed with an algorithm that guarantees the fastest convergence for this type of continued fraction.
The algorithm is the same described in A133593. It is as usually based on the Euclidean division algorithm, but instead of taking the floor of the quotients, as it happens for standard continued fractions, the nearest integer is taken, so the remainders can be also negative and the quotients also.
Generally the convergents of this expansion are a subset of the convergents of the standard continued fraction expansion, and they are no more alternatively lesser and greater than the given number: in this special case of tan(1/3) they are all lesser.
The terms of this sequence can be generated by this formula: a(n) = -3*(-1)^n*(2n-1) for n > 0 (the first term is a(0)=0).
Repeating the expansion for other numbers of type 1/k a common pattern seems to emerge. Examples:
tan(1/4) gives 0, 4, -12, 20, -28, 36, -44, 52, -60, 68, -76, 84, ...
tan(1/5) gives 0, 5, -15, 25, -35, 45, -55, 65, -75, 85, -95, 105, ...
so it seems that in general the terms of tan(1/k) are generated by the formula a(n) = (-1)^(n+1)*k*(2n-1) for n > 0. This formula gives this expansion for tan(1/k):
tan(1/k) = 1/(k+1/(-3k+1/(5k-1/(-7k+1/(9k+1/...))))).
This expansion can be rewritten in an equivalent form:
tan(1/k) = 1/(k-1/(3k-1/(5k-1/(7k-1/(9k-1/...))))).
The rule for converting the first form to the second is this: if two consecutive terms have different sign put a minus before the fraction line, otherwise put plus, and take the absolute value of the terms in the denominators.
This general expansion seems to be valid for any real value of k and resembles Lambert's expansion of tan(k).
The unsigned version of this sequence is A016945. - Colin Barker, Oct 26 2013

Examples

			tan(1/3) = 0 + 1/(3 + 1/(-9 + 1/(15 + 1/(-21 + 1/(27 + ...))))) or
tan(1/3) = 0 + 1/(3 - 1/(9 - 1/(15 - 1/(21 - 1/(27 - ...))))).
		

Crossrefs

Programs

  • Maple
    SCF := proc (n, q::posint)::list; local L, i, z; Digits := 10000; L := [round(n)]; z := n; for i from 2 to q do if z = op(-1, L) then break end if; z := 1/(z-op(-1, L)); L := [op(L), round(z)] end do; return L end proc
    SCF(tan(1/3), 50)  # Giovanni Artico, Oct 26 2013
  • Mathematica
    Join[{0},LinearRecurrence[{-2,-1},{3,-9},50]] (* Harvey P. Dale, Mar 10 2015 *)
  • PARI
    Vec(3*x*(1-x)/(x+1)^2+O(x^100)) \\ Colin Barker, Oct 26 2013

Formula

a(n) = A016945(n-1)*(-1)^(n-1).
Formulae for the general case tan(1/k):
a(0)=0; for n > 0, a(n) = (-1)^(n+1)*k*(2n-1).
tan(1/k) = 1/(k + 1/(-3k + 1/(5k - 1/(-7k + 1/(9k + 1/...))))) or equivalently
tan(1/k) = 1/(k - 1/(3k - 1/(5k - 1/(7k - 1/(9k - 1/...))))).
From Colin Barker, Oct 26 2013: (Start)
a(n) = -2*a(n-1) - a(n-2) for n > 2.
G.f.: 3*x*(1-x) / (x+1)^2. (End)

A228936 Expansion of (1 + 3*x - 3*x^3 - x^4)/(1 + 2*x^2 + x^4).

Original entry on oeis.org

1, 3, -2, -9, 2, 15, -2, -21, 2, 27, -2, -33, 2, 39, -2, -45, 2, 51, -2, -57, 2, 63, -2, -69, 2, 75, -2, -81, 2, 87, -2, -93, 2, 99, -2, -105, 2, 111, -2, -117, 2, 123, -2, -129, 2, 135, -2, -141, 2, 147
Offset: 0

Views

Author

Giovanni Artico, Oct 26 2013

Keywords

Comments

Optimal simple continued fraction (with signed denominators) of exp(1/3). See A228935.
The convergents are a subset of those of the standard regular continued fraction; the sequence of the signs of the difference between the convergents and exp(1/3) starts with: -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, ...
For every couple of successive equal signs in this sequence there is a convergent of the standard expansion not present in this one.
Repeating the expansion for other numbers of type 1/k a common pattern seems to emerge. Examples:
exp(1/4) gives 1, 4, -2, -12, 2, 20, -2, -28, 2, 36, -2, -44, 2, 52, ...
exp(1/5) gives 1, 5, -2, -15, 2, 25, -2, -35, 2, 45, -2, -55, 2, 65, ...
so it seems that in general the terms for exp(1/k) are generated by the formulas a(0)=1, a(2n+1) = (-1)^n*k*(2n+1) for n >= 0, a(2n) = (-1)^n*2 for n > 0. These formulas give this expansion for exp(1/k):
exp(1/k) = 1+1/(k+1/(-2+1/(-3k+1/(2+1/(5k+1/(-2+1/(-7k+1/(2+...)))))))).
which can be rewritten in this equivalent form:
exp(1/k) = 1+1/(k-1/(2+1/(3k-1/(2+1/(5k-1/(2+1/(7k-1/(2+...)))))))).
This general expansion seems to be valid for any real value of k.
Closed form for the general case exp(1/k): b(n) = (1+(-1)^n-(1-(-1)^n)*k*n/2)*i^(n*(n+1)) for n>0 and with i=sqrt(-1). [Bruno Berselli, Nov 01 2013]

Examples

			exp(1/3) = 1+1/(3+1/(-2+1/(-9+1/(2+1/(15+1/(-2+1/(-21+1/(2+...)))))))) or
exp(1/3) = 1+1/(3-1/(2+1/(9-1/(2+1/(15-1/(2+1/(21-1/(2+...))))))))
		

Crossrefs

Programs

  • Maple
    SCF := proc (n, q::posint)::list; local L, i, z; Digits := 10000; L := [round(n)]; z := n; for i from 2 to q do if z = op(-1, L) then break end if; z := 1/(z-op(-1, L)); L := [op(L), round(z)] end do; return L end proc
    SCF(exp(1/3), 50)  # Giovanni Artico, Oct 26 2013
  • PARI
    Vec(-(x-1)*(x+1)*(x^2+3*x+1)/(x^2+1)^2+O(x^100)) \\ Colin Barker, Oct 26 2013

Formula

This sequence can be generated by these formulas:
a(0)=1; for n >= 0, a(2n+1) = 3*(-1)^n*(2n+1), a(2n) = 2*(-1)^n for n > 0.
Formulae for the general case exp(1/k):
b(0)=1; for n >= 0, b(2n+1) = (-1)^n*k*(2n+1), b(2n) = 2*(-1)^n.
b(n) = 2*cos(n*Pi/2) + k*n*sin(n*Pi/2) for n > 0.
exp(1/k) = 1+1/(k-1/(2+1/(3k-1/(2+1/(5k-1/(2+1/(7k-1/(2+...)))))))).
G.f.: (1-x)*(1+x)*(1+k*x+x^2)/(1+x^2)^2.
From Colin Barker, Oct 26 2013: (Start)
a(n) = (-i)^n + i^n + (1/2)*(((-i)^n-i^n)*n)*(3*i) for n > 0, where i=sqrt(-1).
a(2n) = 2*(3*n*sin(Pi*n) + cos(Pi*n)) for n > 0.
a(2n+1) = (6*n+3)*cos(Pi*n) - 2*sin(Pi*n) for n >= 0.
a(n) = -2*a(n-2) - a(n-4) for n > 4.
G.f.: -(x-1)*(x+1)*(x^2+3*x+1) / (x^2+1)^2. (End)

A280135 Negative continued fraction of Pi (also called negative continued fraction expansion of Pi).

Original entry on oeis.org

4, 2, 2, 2, 2, 2, 2, 17, 294, 3, 4, 5, 16, 2, 3, 4, 2, 4, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
Offset: 1

Views

Author

Randy L. Ekl, Dec 26 2016

Keywords

Comments

Appears that these terms are related to continued fraction of Pi through simple transforms; original continued fraction terms X,1 -> negative continued fraction term X+2 (e.g., 15,1->17, and 292,1->294); other transforms are to be determined.

Examples

			Pi = 4 - (1 / (2 - (1 / (2 - (1 / ...))))).
		

References

  • Leonard Eugene Dickson, History of the Theory of Numbers, page 379.

Crossrefs

Cf. A001203 (continued fraction of Pi).
Cf. A133593 (exact continued fraction of Pi).
Cf. A280136 (negative continued fraction of e).

Programs

  • PARI
    \p10000; p=Pi;for(i=1,300,print(i," ",ceil(p)); p=ceil(p)-p;p=1/p )

A228937 Expansion of (1+2*x+30*x^2+13*x^3-13*x^5-30*x^6-2*x^7-x^8)/(1+2*x^4+x^8).

Original entry on oeis.org

1, 2, 30, 13, -2, -17, -90, -28, 2, 32, 150, 43, -2, -47, -210, -58, 2, 62, 270, 73, -2, -77, -330, -88, 2, 92, 390, 103, -2, -107, -450, -118, 2, 122, 510, 133, -2, -137, -570, -148, 2, 152, 630, 163, -2, -167, -690, -178, 2, 182
Offset: 0

Views

Author

Giovanni Artico, Oct 28 2013

Keywords

Comments

Optimal simple continued fraction (with signed denominators) of exp(2/5)
See A228935.
The convergents are a subset of those of the standard regular continued fraction; the sequence of the signs of the difference between the convergents and exp(2/5) starts with:
-1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1,...
For every couple of successive equal signs in this sequence there is a convergent of the standard expansion not present in this one.
Repeating the expansion for other numbers of type 2/k a common pattern seems to emerge. Examples:
exp(2/7) gives 1, 3, 42, 18, -2, -24, -126, -39, 2, 45, 210, 60, -2,...
exp(2/9) gives 1, 4, 54, 23, -2, -31, -162, -50, 2, 58, 270, 77, -2,...
so it seems that in general the terms for exp(2/k) are generated by the following formulas:
b(0)=1, b(1)=k/2-1/2, b(2)=6*k, b(3)=5*k/2+1/2, b(4)=-2, b(5)=7*k/2+1/2, b(6)=-18*k, b(7)=-11*k/2-1/2, b(8)=2; b(n) = -2*b(n-4) -b(n-8) for n>8, recurrence which corresponds to the g.f. 1/2*(1-x)*(1+x)*(2*(1+x^6)+(k-1)*(x+x^5)+(12*k+2)*(x^2+x^4)+6*k*x^3)/(1+x^4)^2; also:
b(0)=1 , b(4m+1)=(-1)^m*((k-1)/2+3*k*m), b(4m+3)=(-1)^m*((5*k+1)/2+3*k*m), b(4m+2)=(-1)^m*(6*k+12*k*m), b(4m+4)=(-1)^(m+1)*2 for n>=0.
These formulas give this expansion for exp(2/k):
exp(2/k)=1+1/((k-1)/2+1/(6k+1/((5k+1)/2+1/(-2+1/(-(7k-1)/2+1/...)))))
that can be rewritten in this equivalent form:
exp(2/k)=1+1/(k/2-1/2+1/(6k+1/(5k/2+1/2-1/(2+1/(7x/2-1/2+1/...))))).
This general expansion seems to be valid for any real value of k.

Examples

			exp(2/5)=1+1/(2+1/(30+1/(13+1/(-2+1/(-17+1/(-90+1/(-28+1/(2+...)))))))),
or equivalently:
exp(2/5)=1+1/(2+1/(30+1/(13-1/(2+1/(17+1/(90+1/(28-1/(2+...)))))))).
		

Crossrefs

Programs

  • Maple
    SCF := proc (n, q::posint)::list; local L, i, z; Digits := 10000; L := [round(n)]; z := n; for i from 2 to q do if z = op(-1, L) then break end if; z := 1/(z-op(-1, L)); L := [op(L), round(z)] end do; return L end proc
    SCF(exp(2/5), 50)
  • Mathematica
    Join[{1}, LinearRecurrence[{0, 0, 0, -2, 0, 0, 0, -1}, {2, 30, 13, -2, -17, -90, -28, 2}, 50]] (* Bruno Berselli, Nov 06 2013 *)

Formula

G.f.: (1+2*x+30*x^2+13*x^3-13*x^5-30*x^6-2*x^7-x^8)/(1+2*x^4+x^8).
a(0)=1, a(1)=2, a(2)=30, a(3)=13, a(4)=-2, a(5)=-17, a(6)=-90, a(7)=-28, a(8)=2; for n>8, a(n) = -2*a(n-4) -a(n-8).
a(0)=1 , a(4m+1) = (-1)^m*(2+15*m), a(4m+3) = (-1)^m*(13+15*m), a(4m+2) = (-1)^m*(30+60*m), a(4m+4) = 2*(-1)^(m+1) for m>=0.
Showing 1-8 of 8 results.