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. 3598856662431775531720113029189271796889051337319684864955538153251303189966833836154162164567900872 9704534292885391330413678901710088367959135173307711907858033355033250775318759985048717977789700603 9564509215375892775265673354024033169441799293934610992626257964647651868659449710216558984360881472 6932495910794738736733785233268774997627277579468536769185419814676687429987673820969139012177220244 0520815109426493495137454166727895534447077777584780259634076907484741555791042006750152034107053352 8512979263524206226753756805576195566972084884385440798332429285136807082752266257975118864646409673 7461572387236295562053612203024635409252678424224347036310363201466298040249015578724456176000319551 9879059699420291788669491748080967465236826540869383990698732117521669570638594118145536473642687824 6292616665010009890380482335951989314615010828872639288766991714930405305774557432156116729898561772 9731395370735291966884327898022165047585028091806291002444277017460241040417786069190065037142835294 2454906015930443552368392371850498719863076339159493659614298835472459099294708267223120172721663872 1241823194246196105775201615274957788183244262017132119335542401421132222670058507790336805573465162 5058402299086387504152574693682112471825684464555601631627713455714375145500762487099156182826892640 7729981514733268896496155714492245865861324197542493067817862593585541905339717891505455586364455620 7938031405845058145545072174155386643901307237932936933245934080446768657784068880825674051153703481 6565354065630569784533262080499053683459751442356111983992647704742776980310110588155817184923932868 9438984433249056919549172687609559508041248481928325971638730802925381959976980415448551217281602262 0331943066629732759531922276659735532353604819525210286700142139979788424355360167959912204261837046 1574804015105025009991759436846692219596062731657764876794148052152436368951852744138140626600534344 1160130978507273085641037453649905644909256402247923589315487176694924367035950430223730003069311959 1523084241294295877978265000937094948239588179495651757952859542579393812959286901360210094380436689 5230969934136129044170346282641703783983574562233703887197009716007655706542390388747191135079115407 6113460540598157919023057562646715753591649187770148755458218502626932492405540852156225044719698236 6623355498628168969666836277890783224455230677866118619070146699590190480961816398991488427181733025 7799164004770479186345072685639394496425950756832920369578587382609087706169484435450991486528604325 6563839001606334030611563035396354098363218835834473080883901296586279484573619192828722289336977367 9782378754977958192808421513984809259437077374990007908490456071228874450083433934927866138800198957 3486716838942067462244279771811654370303605767679629403938379268668419000869373339749628021473634107 0780692080916455960126840415260211299965404360464933269566721032825925715351813046845293343263071155 3780174631715324612012797455054029294074788084660845192475899463976159512778843013427331220165756756 5806148633539294695176441885218053766707456569860604420895261095085491873703174092680684538011907540 1291329997487197399311819288969392181365583868351734155681678400034698319713346050391102634546299985 6564757223256093111851365655574482480889227407246960323744541055785554440720166467493389833937288915 1220506417791420513075047178464494481190580355233808384792957016490096134916888581297171817768451298 1665227044587895064381632466716623456986007517070420876709054233838759070653573007253574394206705393 5148901677468489802358168560404432836899625111068902619969865411395855004788917241289286530573960459 5295630481898478597793315200704134070112095034002798606741184490842312210024287525516602104585306029 2289223852006142473539225041071819196928056846063784532923591030025488703448802727717215706091545941 7474643895043912810893731709815790456698059914515117822228133828389982423597202827748945586513936391 3452483856497779453908416516460978752950017442754760447885185602468844734514836066921399141711901083 1690071173387674418305904927409836582097264917617521770580171687599878686607279150571455108080357714 7491050368534425788904420130557264259368697331394411507164801544674950358546377607632431556042666304 6395542580903240913570090526524804830062465306678595083246280842958974835302789009884602603688205927 5805246320877241175806919587775824030345471575187291048996858386653149338028486536933731835469634484 1504409214989225169996649489728498977896403775562848049318751954749956830451650035737932722881001804 8645762348363517623751659020950704697406203331771644770740661428929730720327030807528292464987612187 1232946637089850970178107394569897412173407761508528674095980750718116241938858864474274231665018464 7155456924995727693783282469600644529937841927359038656842258899830282105202384015914721662892536042 5063252391662328999983261110421638912207863127804805325388720787788799872365244078850903523599082782 8414181800399377391095071207605458065225083133579192674740291736305230994186482805359949788319437063 7130973308230247562432877484228712237016923662369461886816656884513142562955638706348933266084295898 6227472341790602961565064174323288252791808671880043827099494781848823448193939072896952220975651912 1030411392292094514485172496311665852443297691100346806326740548244268513436879291868533182598470087 9220239408971216227279877953323775349945039024932079177364549937478642577491197058330559338273544727 1134221807742456974953724974489261123515507129685555240436380725874367910005837446810978255085540543 3492939325759223450591740615516403903918873491034468804911112707451960737139021658502103300989642052 7321939834725415796821002502271249554120121025244346627919853639386895273974434448699101642211863473 3554275003888717838948900850488919327489864187220493115750305086338610399788495072841619229512956464 1167845262917694281285926625139269190293311557455201854028539836805543506193260763708878314454605197 9284679230847525053638862165004745708897363189821976439370182712105350079855799226903395953595168080 9620037419999626918565090460953483538527029526100915394547290210577360497434054549881727278592288106 2287130684765190663814395879804108303871457411002012145416443419707577170889406831535049996486501544 6879157493970742234650861724951763074029550704469056226038982964928539332225166521449253559105851315 6039564122468614339957167007922646487717199981696560832592190030904898834041325716770947944376212375 8418814541068236434852781751846517903082609413212224238058656489765610037931876681570890681087043185 4715100571264280538494219675110893881004201113687571324526477426885847639756543394472785484058859698 9187265385068029254539783436948429908016505640482034777189954498441103548738139429980046724746615883 4330818415048041039982302767345624807150981486393727117922131463758195593233083856740054416013392228 8414921740582786401173677753795454902087684066372700053401549204929536220272140860696666518263028817 9890262313156542239259725743410983683321279726193540072629802319606915201174336179105817625089102667 8980736215429334205149488609535676682493284752037158654951701473731036754181217046556406461869079775 8292973151786221473288538024719480246270616424308347343862514716595211971618757218710481830210593274 1139017216632565287246297512546016578184416129917616436254116551997134719876167826650857165428479186 9356403233932569596115552076369117894456288235093266827550836587545952089310450094506004547283392781 9574681401694719899728047158634057108159394395561695520662881741662699120335222315264649283885353148 9320579771936646085777825152121511737166999667880160773151143126114754613009241965853785923633232564 1357228261412493013487981939620734422496618548266761126504490471886324973675078276469944404711328520 5947459470033299620484251255352937600589249165362677820368284873450846108124372003823553827110688904 2418455316419341049360692440726786423890246101718999421600354767923430309707491372903377670114849941 1172690045594168399242223639138839501733146534206187652241454229764195939562981812434386627839203404 1257539246229268163364858978340009564026038432286054931968668919752602111416427223201695871782144737 8726197216574284883150190036253438339853864512567427320320149252501514399664107482680973312066433913 4650744722768479409051942040791062507002331391073826707927803699729704157698029932928263661158767383 5576693381435519164156306622673722004282010771021530750455216871202578164359755228243865676136928866 3076536016017385019052117692461951240519656481099137695310965480946781476863894470517445063584793959 8777669953351034655293874818468555828475415688868467224793390038216974457209569622866642688381245086 0264125921666549499357286946352369609787733257078868359072740577898931177507940411413886951643762405 8631589233005938695984942779684023196053491677988921291925147942350121557059139840124818625612854227 5207267750846279258286069193365146952339365838210530574170656574609004807341559252410857212410419694 6591444541314379467545347670595929591285479540373549309956578581609074954238032013004280240471527813 7533393515301550823684477265856361900803465618230708781680879526799862498249811516544902542583219840 6242683328934556135032701485694625736192074253817806051722448673156802654444185117569725868099674048 3830208602712905524220855578217909707553827232063691355289266420823673050591820810378886076613027519 0852574120352674424193238382805305035305333895990882079511465845916193994753621113676029446721710802 6206772700647278686050981031582264900315022686207377591889323356687218654589715504072722058716576345 1915638371580082840435779538890761901727659227760912768172247875715332312141059312712892581354100217 5380406717053948041765994962625291895031901793248736176547271131476802522473649000538511626248233023 6797920866945773457158280039325852422112491481336166820822815611855879725218492700802231809941354732 9310133843121549678037654600837695100916298274109418115255126924344805323664167369707108525868956845 4598603507277597884969024373932905255051647371259436707368992583605367398150508810482624406503050162 2731087218373374630929851762463192409293755231323781407294463188276598509486471284679973618781510620 ----------------------------------------------------- ( 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). |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: