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.
%I A228929 #30 Jan 19 2024 20:15:54 %S A228929 7,-113,4739,-46804,134370,-614063,1669512,-15474114,-86232481, %T A228929 1080357006,-8574121305,-24144614592,133884333083,-2239330253016, %U A228929 -6347915250018,14541933941298,-42301908155404,-298013673554972,5177473084279656,-46709468571434452,1201667304102142095,-68508286025632748778,850084640720511629243,-2458418086834560217354 %N A228929 Optimal ascending continued fraction expansion of Pi - 3. %C A228929 Definition of the expansion: for a positive real number x, there is always a unique sequence of signed integers with increasing absolute value |a(i)|>|a(i-1)| such that x =floor(x)+ 1/a(1) + 1/a(1)/a(2) + 1/a(1)/a(2)/a(3) + 1/a(1)/a(2)/a(3)/a(4) ... or equivalently x=floor(x)+1/a(1)*(1+1/a(2)*(1+1/a(3)*(1+1/a(4)*(1+...)))) giving the fastest converging series with this representation. This formula can be represented as a regular ascending continued fraction. The expansion is similar to Engel and Pierce expansions, but the sign of the terms is not predefined and determined by the algorithm for optimizing the convergence. %C A228929 For x rational number the expansion has a finite number of terms, for x irrational an infinite number. Empirically the sequence doesn't show any evident regularity except in some interesting cases. %H A228929 G. C. Greubel, <a href="/A228929/b228929.txt">Table of n, a(n) for n = 1..500</a> %F A228929 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 A228929 Pi = 3 + 1/7*(1 - 1/113*(1 + 1/4739*(1 - 1/46804*(1 + 1/134370*(1 - 1/614063*(1 + 1/1669512*(1 + ...))))))). %p A228929 # Slow procedure valid for every number %p A228929 ArticoExp := proc (n, q::posint)::list; local L, i, z; Digits := 50000; L := []; z := n-floor(n); for i to q+1 do if z = 0 then break end if; L := [op(L), round(1/abs(z))*sign(evalf(z))]; z := abs(z)*round(1/abs(z))-1 end do; return L end proc %p A228929 # Fast procedure, not suited for rational numbers %p A228929 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 A228929 # List the first 20 terms of the expansion of Pi %p A228929 ArticoExp(Pi,20) %t A228929 ArticoExp[x_, n_] := Round[1/#] & /@ NestList[Round[1/Abs[#]]*Abs[#] - 1 &, FractionalPart[x], n]; Block[{$MaxExtraPrecision = 50000}, ArticoExp[Pi, 20]] %o A228929 (Derive) %o A228929 ArticoExp(x, n) := VECTOR(ROUND(1, ABS(k))*SIGN(k), k, ITERATES(ROUND(1, ABS(u))*ABS(u) - 1, u, MOD(x), n)) %o A228929 Precision:=Mixed %o A228929 PrecisionDigits:=10000 %o A228929 ArticoExp(PI,20) %Y A228929 Cf. A006784, A015884, A228930, A228931, A228932, A228933, A228934. %K A228929 sign %O A228929 1,1 %A A228929 _Giovanni Artico_, Sep 08 2013