%I #26 Sep 06 2021 11:14:49
%S 1,7,112,115,157,372,432,1340,7034,8396,9200,18846,29558,34050,89754,
%T 101768,1361737,48461857,81164005,145676139,163820009,182446527,
%U 5021656281,8401618827,22255558907,28334352230,127113921970,310272097461,782301280193,5560255100022,9925600136870,85169484256928,2542699818508737,3145584963639199,397021758001902006,467746771316089905
%N Pierce expansion for 4 - Pi.
%C Also, alternating Engel expansion for Pi.
%C Pi = 4 - 1/1 + 1/(1*7) - 1/(1*7*112) + 1/(1*7*112*115) - ...
%C Pierce expansions are always strictly increasing.
%H G. C. Greubel and T. D. Noe, <a href="/A061233/b061233.txt">Table of n, a(n) for n = 0..1000</a> (terms 0 to 400 computed by T. D. Noe; terms 401 to 1000 computed by G. C. Greubel, Dec 31 2016)
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PierceExpansion.html">Pierce Expansion</a>
%H <a href="/index/El#Engel">Index entries for sequences related to Engel expansions</a>
%p Digits := 1000: x0 := 4-Pi-4^(-1000): x1 := 4-Pi+4^(-1000): ss := []: # when expansions of x0 and x1 differ, halt
%p k0 := floor(1/x0): k1 := floor(1/x1): while k0=k1 do ss := [op(ss),k0]: x0 := 1-k0*x0: x1 := 1-k1*x1: k0 := floor(1/x0): k1 := floor(1/x1): od:
%t PierceExp[A_, n_] := Join[Array[1 &, Floor[A]], First@Transpose@
%t NestList[{Floor[1/Expand[1 - #[[1]] #[[2]]]], Expand[1 - #[[1]] #[[2]]]} &, {Floor[1/(A - Floor[A])], A - Floor[A]}, n - 1]]; PierceExp[N[4 - Pi, 7!], 25] (* _G. C. Greubel_, Dec 31 2016 *)
%o (PARI) A061233(N=199)={localprec(N); my(c=4-Pi, d=c+c/10^N, a=[1\c]); while(a[#a]==1\d&&c=1-c*a[#a], d=1-d*a[#a]; a=concat(a, 1\c)); a[^-1]} \\ optional arg fixes precision, roughly equal to total number of digits in the result. - _M. F. Hasler_, Nov 24 2020
%Y A014014 and A015884 are inferior versions of this sequence.
%Y Cf. A154956 (analog for 2/Pi).
%K nonn,easy,nice
%O 0,2
%A _Frank Ellermann_, May 15 2001
%E More terms from Eric Rains (rains(AT)caltech.edu), May 31 2001
|