Post Reply 
Reciprocal Fibonacci Constant to 10100 places (Emulated HP-50g)
11-02-2018, 02:58 AM (This post was last modified: 11-12-2018 01:47 AM by Gerson W. Barbosa.)
Post: #1
Reciprocal Fibonacci Constant to 10100 places (Emulated HP-50g)
 
\(\psi = \sum_{k=1}^{\infty} \frac{1}{F_k} = \frac{1}{1} + \frac{1}{1} + \frac{1}{2} + \frac{1}{3} + \frac{1}{5} + \frac{1}{8} + \frac{1}{13} + \frac{1}{21} + \cdots.\)

The computation of the reciprocal Fibonacci constant per the above definition to the number of decimal places in the thread subject would require at least 48326 terms, the last denominator being a 10100-digit long integer. By using a more efficient formula, this task can be done in about a couple of hours on an emulated HP-50g by evaluating only the first 156 terms of the series plus another 156 terms of a continued fraction (which are evaluated two at a time in the same loop, so only 78 iterations are required).

For more details refer to this old thread (updated last post).

This is essentially the same program there, except that « ALOG » has been replaced with « 2 IDIV2 ALOG SWAP ALOG SQ * », so that the maximum number of digits is doubled to 19998.

The first 9999 decimal digits of the constant can be checked at http://oeis.org/A079586/b079586.txt

-----------------------------------------------------

# A959h, 482.5 bytes


« PUSH RAD -105 CF -3 CF DUP √
DUP √ √ 5 * INV NEG 5 √ 1 + 2 /
+ * 2 INV - CEIL DUP 2 MOD + DUP
0 ROT
[[ 1 1 ]
[ 1 0 ]] SWAP DUP2 ^ 3 GETI
UNROT GET 4 ROLLD 4 ROLLD DUP +
^ 1 GETI UNROT GET 1 + 0 1 8
ROLL 2 /
 START PICK3 + DUP PICK3 * NEG
6 PICK SQ + / 4 PICK SQ * EXPAND
ROT PICK3 - ROT OVER - ROT 6
ROLL 6 ROLL 6 ROLL + LASTARG *
LASTARG 5 ROLLD 5 ROLLD / + ROT
PICK3 - ROT OVER - 6 ROLL 6 ROLL
6 ROLL
 NEXT ROT + INV 5 ROLL + EXPAND
4 ROLLD 3 DROPN FXND PICK3 2
IDIV2 ALOG SWAP ALOG SQ * OVER -
PICK3 * SWAP IQUOT + →STR DUP
HEAD -51 FC? { "." } { "," }
IFTE + SWAP TAIL + 1 ROT 2 + SUB
POP
»


10100 TEVAL -->

:s: 7968.1859

3.

35988566624317755317201130291892717968890513373196848649555381532513031899668338​36154162164567900872
97045342928853913304136789017100883679591351733077119078580333550332507753187599​85048717977789700603
95645092153758927752656733540240331694417992939346109926262579646476518686594497​10216558984360881472
69324959107947387367337852332687749976272775794685367691854198146766874299876738​20969139012177220244
05208151094264934951374541667278955344470777775847802596340769074847415557910420​06750152034107053352
85129792635242062267537568055761955669720848843854407983324292851368070827522662​57975118864646409673
74615723872362955620536122030246354092526784242243470363103632014662980402490155​78724456176000319551
98790596994202917886694917480809674652368265408693839906987321175216695706385941​18145536473642687824
62926166650100098903804823359519893146150108288726392887669917149304053057745574​32156116729898561772
97313953707352919668843278980221650475850280918062910024442770174602410404177860​69190065037142835294

24549060159304435523683923718504987198630763391594936596142988354724590992947082​67223120172721663872
12418231942461961057752016152749577881832442620171321193355424014211322226700585​07790336805573465162
50584022990863875041525746936821124718256844645556016316277134557143751455007624​87099156182826892640
77299815147332688964961557144922458658613241975424930678178625935855419053397178​91505455586364455620
79380314058450581455450721741553866439013072379329369332459340804467686577840688​80825674051153703481
65653540656305697845332620804990536834597514423561119839926477047427769803101105​88155817184923932868
94389844332490569195491726876095595080412484819283259716387308029253819599769804​15448551217281602262
03319430666297327595319222766597355323536048195252102867001421399797884243553601​67959912204261837046
15748040151050250099917594368466922195960627316577648767941480521524363689518527​44138140626600534344
11601309785072730856410374536499056449092564022479235893154871766949243670359504​30223730003069311959

15230842412942958779782650009370949482395881794956517579528595425793938129592869​01360210094380436689
52309699341361290441703462826417037839835745622337038871970097160076557065423903​88747191135079115407
61134605405981579190230575626467157535916491877701487554582185026269324924055408​52156225044719698236
66233554986281689696668362778907832244552306778661186190701466995901904809618163​98991488427181733025
77991640047704791863450726856393944964259507568329203695785873826090877061694844​35450991486528604325
65638390016063340306115630353963540983632188358344730808839012965862794845736191​92828722289336977367
97823787549779581928084215139848092594370773749900079084904560712288744500834339​34927866138800198957
34867168389420674622442797718116543703036057676796294039383792686684190008693733​39749628021473634107
07806920809164559601268404152602112999654043604649332695667210328259257153518130​46845293343263071155
37801746317153246120127974550540292940747880846608451924758994639761595127788430​13427331220165756756

58061486335392946951764418852180537667074565698606044208952610950854918737031740​92680684538011907540
12913299974871973993118192889693921813655838683517341556816784000346983197133460​50391102634546299985
65647572232560931118513656555744824808892274072469603237445410557855544407201664​67493389833937288915
12205064177914205130750471784644944811905803552338083847929570164900961349168885​81297171817768451298
16652270445878950643816324667166234569860075170704208767090542338387590706535730​07253574394206705393
51489016774684898023581685604044328368996251110689026199698654113958550047889172​41289286530573960459
52956304818984785977933152007041340701120950340027986067411844908423122100242875​25516602104585306029
22892238520061424735392250410718191969280568460637845329235910300254887034488027​27717215706091545941
74746438950439128108937317098157904566980599145151178222281338283899824235972028​27748945586513936391
34524838564977794539084165164609787529500174427547604478851856024688447345148360​66921399141711901083

16900711733876744183059049274098365820972649176175217705801716875998786866072791​50571455108080357714
74910503685344257889044201305572642593686973313944115071648015446749503585463776​07632431556042666304
63955425809032409135700905265248048300624653066785950832462808429589748353027890​09884602603688205927
58052463208772411758069195877758240303454715751872910489968583866531493380284865​36933731835469634484
15044092149892251699966494897284989778964037755628480493187519547499568304516500​35737932722881001804
86457623483635176237516590209507046974062033317716447707406614289297307203270308​07528292464987612187
12329466370898509701781073945698974121734077615085286740959807507181162419388588​64474274231665018464
71554569249957276937832824696006445299378419273590386568422588998302821052023840​15914721662892536042
50632523916623289999832611104216389122078631278048053253887207877887998723652440​78850903523599082782
84141818003993773910950712076054580652250831335791926747402917363052309941864828​05359949788319437063

71309733082302475624328774842287122370169236623694618868166568845131425629556387​06348933266084295898
62274723417906029615650641743232882527918086718800438270994947818488234481939390​72896952220975651912
10304113922920945144851724963116658524432976911003468063267405482442685134368792​91868533182598470087
92202394089712162272798779533237753499450390249320791773645499374786425774911970​58330559338273544727
11342218077424569749537249744892611235155071296855552404363807258743679100058374​46810978255085540543
34929393257592234505917406155164039039188734910344688049111127074519607371390216​58502103300989642052
73219398347254157968210025022712495541201210252443466279198536393868952739744344​48699101642211863473
35542750038887178389489008504889193274898641872204931157503050863386103997884950​72841619229512956464
11678452629176942812859266251392691902933115574552018540285398368055435061932607​63708878314454605197
92846792308475250536388621650047457088973631898219764393701827121053500798557992​26903395953595168080

96200374199996269185650904609534835385270295261009153945472902105773604974340545​49881727278592288106
22871306847651906638143958798041083038714574110020121454164434197075771708894068​31535049996486501544
68791574939707422346508617249517630740295507044690562260389829649285393322251665​21449253559105851315
60395641224686143399571670079226464877171999816965608325921900309048988340413257​16770947944376212375
84188145410682364348527817518465179030826094132122242380586564897656100379318766​81570890681087043185
47151005712642805384942196751108938810042011136875713245264774268858476397565433​94472785484058859698
91872653850680292545397834369484299080165056404820347771899544984411035487381394​29980046724746615883
43308184150480410399823027673456248071509814863937271179221314637581955932330838​56740054416013392228
84149217405827864011736777537954549020876840663727000534015492049295362202721408​60696666518263028817
98902623131565422392597257434109836833212797261935400726298023196069152011743361​79105817625089102667

89807362154293342051494886095356766824932847520371586549517014737310367541812170​46556406461869079775
82929731517862214732885380247194802462706164243083473438625147165952119716187572​18710481830210593274
11390172166325652872462975125460165781844161299176164362541165519971347198761678​26650857165428479186
93564032339325695961155520763691178944562882350932668275508365875459520893104500​94506004547283392781
95746814016947198997280471586340571081593943955616955206628817416626991203352223​15264649283885353148
93205797719366460857778251521215117371669996678801607731511431261147546130092419​65853785923633232564
13572282614124930134879819396207344224966185482667611265044904718863249736750782​76469944404711328520
59474594700332996204842512553529376005892491653626778203682848734508461081243720​03823553827110688904
24184553164193410493606924407267864238902461017189994216003547679234303097074913​72903377670114849941
11726900455941683992422236391388395017331465342061876522414542297641959395629818​12434386627839203404

12575392462292681633648589783400095640260384322860549319686689197526021114164272​23201695871782144737
87261972165742848831501900362534383398538645125674273203201492525015143996641074​82680973312066433913
46507447227684794090519420407910625070023313910738267079278036997297041576980299​32928263661158767383
55766933814355191641563066226737220042820107710215307504552168712025781643597552​28243865676136928866
30765360160173850190521176924619512405196564810991376953109654809467814768638944​70517445063584793959
87776699533510346552938748184685558284754156888684672247933900382169744572095696​22866642688381245086
02641259216665494993572869463523696097877332570788683590727405778989311775079404​11413886951643762405
86315892330059386959849427796840231960534916779889212919251479423501215570591398​40124818625612854227
52072677508462792582860691933651469523393658382105305741706565746090048073415592​52410857212410419694
65914445413143794675453476705959295912854795403735493099565785816090749542380320​13004280240471527813

75333935153015508236844772658563619008034656182307087816808795267998624982498115​16544902542583219840
62426833289345561350327014856946257361920742538178060517224486731568026544441851​17569725868099674048
38302086027129055242208555782179097075538272320636913552892664208236730505918208​10378886076613027519
08525741203526744241932383828053050353053338959908820795114658459161939947536211​13676029446721710802
62067727006472786860509810315822649003150226862073775918893233566872186545897155​04072722058716576345
19156383715800828404357795388907619017276592277609127681722478757153323121410593​12712892581354100217
53804067170539480417659949626252918950319017932487361765472711314768025224736490​00538511626248233023
67979208669457734571582800393258524221124914813361668208228156118558797252184927​00802231809941354732
93101338431215496780376546008376951009162982741094181152551269243448053236641673​69707108525868956845
45986035072775978849690243739329052550516473712594367073689925836053673981505088​10482624406503050162

27310872183733746309298517624631924092937552313237814072944631882765985094864712​84679973618781510620



-----------------------------------------------------

( 11-07-2018 12:33 AM ) Update:

A surprisingly good approximation for the number of terms (n) required for the desired number of significant digits (d) is

\(n\approx \left \lceil \frac{\sqrt{2\pi d}}{\varphi }-1 \right \rceil \)

For safeguard, the " - 1 " term is suppressed in the programs below.

%%HP: T(3)A(R)F(.);
\<< PUSH RAD -105 CF -3 CF R\->I DUP 1 + DUP + \pi * \v/ 5 \v/ 1 + 2 / / CEIL DUP 2 MOD + DUP 0 ROT
[[ 1 1 ]
 [ 1 0 ]] SWAP DUP2 ^ 3 GETI UNROT GET 4 ROLLD 4 ROLLD DUP + ^ 1 GETI UNROT GET 1 + 0 1 8 ROLL 2 /
  START PICK3 + DUP PICK3 * NEG 6 PICK SQ + / 4 PICK SQ * EXPAND ROT PICK3 - ROT OVER - ROT 6 ROLL 6 ROLL 6 ROLL + LASTARG * LASTARG 5 ROLLD 5 ROLLD / + ROT PICK3 - ROT OVER - 6 ROLL 6 ROLL 6 ROLL
  NEXT ROT + INV 5 ROLL + EXPAND 4 ROLLD 3 DROPN FXND PICK3 ALOG OVER - PICK3 * SWAP IQUOT + \->STR DUP HEAD -51 FC? { "." } { "," } IFTE + SWAP TAIL + 1 ROT 2 + SUB POP
\>>


%%HP: T(3)A(R)F(.);
\<< PUSH RAD -105 CF -3 CF R\->I DUP 1 + DUP + \pi * \v/ 5 \v/ 1 + 2 / / CEIL DUP 2 MOD + DUP 0 ROT
[[ 1 1 ]
 [ 1 0 ]] SWAP DUP2 ^ 3 GETI UNROT GET 4 ROLLD 4 ROLLD DUP + ^ 1 GETI UNROT GET 1 + 0 1 8 ROLL 2 /
  START PICK3 + DUP PICK3 * NEG 6 PICK SQ + / 4 PICK SQ * EXPAND ROT PICK3 - ROT OVER - ROT 6 ROLL 6 ROLL 6 ROLL + LASTARG * LASTARG 5 ROLLD 5 ROLLD / + ROT PICK3 - ROT OVER - 6 ROLL 6 ROLL 6 ROLL
  NEXT ROT + INV 5 ROLL + EXPAND 4 ROLLD 3 DROPN FXND PICK3 2 IDIV2 ALOG SWAP ALOG SQ * OVER - PICK3 * SWAP IQUOT + \->STR DUP HEAD -51 FC? { "." } { "," } IFTE + SWAP TAIL + 1 ROT 2 + SUB POP
\>>


The latter should be used for more than 9999 digits (up to 19998 digits). This can be increased even further by replacing ALOG in the first program with « 4 IDIV2 ALOG SWAP ALOG SQ SQ * ».

-----------------------------------------------------

Update:

Exact expressions for n = f(d) and new RPL and Decimal BASIC program versions at the original thread (scroll down to the last update).
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Reciprocal Fibonacci Constant to 10100 places (Emulated HP-50g) - Gerson W. Barbosa - 11-02-2018 02:58 AM



User(s) browsing this thread: 1 Guest(s)