Obtaining More Decimal Digits (50g) - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: Obtaining More Decimal Digits (50g) (/thread-230389.html) Obtaining More Decimal Digits (50g) - Eddie W. Shore - 08-30-2012 Re: Obtaining More Decimal Digits (50g) - Gilles Carpentier - 09-01-2012 Hi Eddy, Interesting. Here is a program wich calcultate n digits of PI with the same idea using BMP (Plouffe) formula ```«  -> n « 0 @ initial Value of PI n ALOG @ Number of digits to find 1 @ 16^k initial value = 16^0 0 '2+LOG(8*n)+n*LOG(16)' >NUM CEIL R>I FOR k @ Number of iteration k 1. DISP @ Display iterations OVER [ 120 151 47 ] k PEVAL * @ Nominator * n ALOG OVER 16 * SWAP ROT @ 16^k and 16^(k+1) on the stack [ 512 1024 712 194 15 ] k PEVAL * @ Denominator IQUOT 4. ROLL + UNROT @ Integer quotient and add to ~PI NEXT DROP2 » » 'nPi' STO ``` The idea is that if you expand Plouffe formula : ```'(1/(16^k))*((((4/((8*k)+1))-(2/((8*k)+4)))-(1/((8*k)+5)))-(1/((8*k)+6)))' EVAL EXPAND -> '(k^2*120+151*k+47)/((512*k^4+1024*k^3+712*k^2+194*k+15)*2^(4*k))' ``` 500 nPi gives the 500 first décimal of PI in ~ 3mn on a real calc (few seconds with emu48)(the last 3 digits are wrong) As you can see here, the BMP formula is very interesting to calculate the n'th dgit of PI in hexadecimal : Edited: 1 Sept 2012, 5:55 a.m. Re: Obtaining More Decimal Digits (50g) - Eddie W. Shore - 09-13-2012 I kind of get stuck at matching 20 digits for pi. (correct digits of pi are separated) 24 nPi returns 314159265358979323846 1556 30 nPi returns 314159265358979323846 1565762641 36 nPi returns 314159265358979323846 1565762653862973 Eddie Sorry for the late reply Re: Obtaining More Decimal Digits (50g) - Gilles Carpentier - 09-13-2012 Hi You must be in 'exact mode' (uncheck APPROX in CAS setup) and _no decimal point_ in the numbers used for calculation in the program 36 nPI 3141592653589793238462643383279502869 2500 nPI 3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796782354781636009341721641219924586315030286182974555706749838505494588586926995690927210797509302955321165344987202755960236480665499119881834797753566369807426542527862551818417574672890977772793800081647060016145249192173217214772350141441973568548161361157352552133475741849468438523323907394143334547762416862518983569485562099219222184272550254256887671790494601653466804988627232791786085784383827967976681454100953883786360950680064225125205117392984896084128488626945604241965285022210661186306744278622039194945047123713786960956364371917287467764657573962413890865832645995813390478027590099465764078951269468398352595709825822620522489407726719478268482601476990902640136394437455305068203496252451749399651431429809190659250937221696461515709858387410597885959772975498930161753928468138268683868942774155991855925245953959431049972524680845987273644695848653836736222626099124608051243884390451244136549762780797715691435997700129616089441694868555848406353422072225828488648158456027509 Edited: 13 Sept 2012, 5:57 p.m.