OFFSET
0,2
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
LINKS
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)
EXAMPLE
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 - ...))))).
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 *)
PROG
(PARI) Vec(3*x*(1-x)/(x+1)^2+O(x^100)) \\ Colin Barker, Oct 26 2013
CROSSREFS
KEYWORD
sign,cofr,easy
AUTHOR
Giovanni Artico, Oct 25 2013
STATUS
approved