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.

A228930 Optimal ascending continued fraction expansion of e - 2.

This page as a plain text file.
%I A228930 #13 Dec 27 2016 02:35:19
%S A228930 1,-4,8,67,266,9757,47748,-97258,-251115,671488,-4724169,-28356343,
%T A228930 125269419,-498668029,-5426804695,15313259790,-40462770156,
%U A228930 105160602326,-4412226092528,-350847041434052,-54342998565206181
%N A228930 Optimal ascending continued fraction expansion of e - 2.
%C A228930 See A228929 for explanation.
%H A228930 G. C. Greubel, <a href="/A228930/b228930.txt">Table of n, a(n) for n = 1..500</a>
%F A228930 Given a positive real number x, let z(0) = x - floor(x) and z(k+1) = abs(z(k))*round(1/abs(z(k))) - 1; then a(n) = sign(z(n))*round(1/abs(z(n))) for n>0.
%e A228930 e = 2 + 1*(1 - 1/4*(1 + 1/8*(1 + 1/67*(1 + 1/266*(1 + 1/9757*(1 + ...)))))).
%p A228930 ArticoExp := proc (n, q::posint)::list; local L, i, z; Digits := 50000; L := []; z := frac(evalf(n)); for i to q+1 do if z = 0 then break end if; L := [op(L), round(1/abs(z))*sign(z)]; z := abs(z)*round(1/abs(z))-1 end do; return L end proc
%p A228930 # List the first 20 terms of the expansion of exp(1)-2
%p A228930 ArticoExp(exp(1),20)
%t A228930 ArticoExp[x_, n_] := Round[1/#] & /@ NestList[Round[1/Abs[#]]*Abs[#] - 1 &, FractionalPart[x], n]; Block[{$MaxExtraPrecision = 50000}, ArticoExp[Exp[1] - 2, 20]] (* _G. C. Greubel_, Dec 26 2016 *)
%Y A228930 Cf. A228929.
%K A228930 sign,cofr
%O A228930 1,2
%A A228930 _Giovanni Artico_, Sep 09 2013