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.

A228667 Array: row n shows the accelerated continued fraction of F(n+1)/F(n), where F = A000045 (Fibonacci numbers).

This page as a plain text file.
%I A228667 #18 Aug 16 2025 23:52:25
%S A228667 1,2,1,2,1,1,2,2,-2,-2,2,-3,3,2,-3,2,2,2,-3,3,-3,2,-3,3,-2,-2,2,-3,3,
%T A228667 -3,3,2,-3,3,-3,2,2,2,-3,3,-3,3,-3,2,-3,3,-3,3,-2,-2,2,-3,3,-3,3,-3,3,
%U A228667 2,-3,3,-3,3,-3,2,2,2,-3,3,-3,3,-3,3,-3,2,-3,3
%N A228667 Array:  row n shows the accelerated continued fraction of F(n+1)/F(n), where F = A000045 (Fibonacci numbers).
%C A228667 The accelerated continued fraction (ACF) of a positive rational number x/y, where GCD(x,y) = 1, is defined by the algorithm below.  The number of terms in ACF(x/y) is <= the number of terms in the classical continued fraction CF(x/y).
%C A228667 Step 1.  Put w = Mod[x,y].  If w=0, put c(0) = x/y and Stop.
%C A228667 If 0 < w <= y/2, put c(0) = floor(x/y), u->y, v->w, f->1, go to step 2;
%C A228667 if w>y/2, put c(0) = 1 + floor(x/y), u->y, v->y - w, f->-1, go to step 2.
%C A228667 For i>=2, Step i is in 5 cases, as follows:
%C A228667 Case 0.1:  f = 1 and w = 0.  Put w = Mod[x,y] and c(i) = u/v and Stop.
%C A228667 Case 0.2:  f = -1 and w = 0.  Put w = Mod[x,y] and c(i) = -u/v and Stop.
%C A228667 Case 1:  f = 1 and w <= v/2.  Put w = Mod[x,y] and c(i) = floor(u/v), u->v, v->w, f->1, go to step i+1.
%C A228667 Case 2:  f = 1 and w > v/2.  Put w = Mod[x,y] and c(i) = 1 + floor(u/v), u->y, v->v - w, f->-1, go to step i+1.
%C A228667 Case 3:  f = -1 and w <= v/2.  Put w = Mod[x,y] and c(i) = -floor(u/v), u->v, v->w, f->-1, go to step i+1.
%C A228667 Case 4:  f = -1 and w > v/2.  Put w = Mod[x,y] and c(i) = -1 - floor(u/v), u->y, v->v - w, f->-f, go to step i+1.
%e A228667 x/y ......... ACF(x/y)
%e A228667 1/1 ......... 1
%e A228667 2/1 ......... 2
%e A228667 3/2 ......... 1,2
%e A228667 5/3 ......... 1,1,2
%e A228667 8/5 ......... 2,-2,-2
%e A228667 13/8 ........ 2,-3,3
%e A228667 21/13 ....... 2,-3,2,2
%e A228667 34/21 ....... 2,-3,3,-3
%e A228667 55/34 ....... 2,-3,3,-2,-2
%e A228667 89/55 ....... 2,-3,3,-3,3
%t A228667 $MaxExtraPrecision = Infinity; aCF[rational_] := Module[{steps = {}, stop = False, i = 0, x = Numerator[rational], y = Denominator[rational], w, u, v, f, c},(*Step 1*)w = Mod[x, y]; Which[w == 0, c[i] = x/y; stop = True; AppendTo[steps, "A"], 0 < w <= y/2, c[i] = Floor[x/y]; {u, v, f} = {y, w, 1}; AppendTo[steps, "B"], w > y/2, c[i] = 1 + Floor[x/y]; {u, v, f} = {y, y - w, -1}; AppendTo[steps, "C"]];  i++; (*Step 2*)While[stop =!= True, w = Mod[u, v]; Which[f == 1 && w == 0, c[i] = u/v; stop = True; AppendTo[steps, "0.1"], f == -1 && w == 0, c[i] = -u/v; stop = True; AppendTo[steps, "0.2"], f == 1 && w <= v/2, c[i] = Floor[u/v]; {u, v, f} = {v, w, 1}; AppendTo[steps, "1"], f == 1 && w > v/2, c[i] = 1 + Floor[u/v]; {u, v, f} = {v, v - w, -1}; AppendTo[steps, "2"], f == -1 && w <= v/2, c[i] = -Floor[u/v]; {u, v, f} = {v, w, -1}; AppendTo[steps, "3"], f == -1 && w > v/2, c[i] = -1 - Floor[u/v]; {u, v, f} = {v, v - w, -f}; AppendTo[steps, "4"]]; i++];  (*Display results*){FromContinuedFraction[#], {"Steps", steps}, {"ACF", #}, {"CF", ContinuedFraction[x/y]}} &[Map[c, Range[i] - 1]]]
%t A228667 Table[aCF[Fibonacci[n + 1]/Fibonacci[n]], {n, 1, 20}]
%t A228667 (* _Peter J. C. Moses_, Aug 28 2013 *)
%Y A228667 Cf. A000045, A228668, A228489.
%K A228667 tabf,easy,sign
%O A228667 0,2
%A A228667 _Clark Kimberling_, Aug 29 2013