Post Reply 
[VA] SRC#002- Almost integers and other beasties
02-10-2019, 04:06 PM (This post was last modified: 02-10-2019 04:14 PM by Gerson W. Barbosa.)
Post: #28
RE: [VA] SRC#002- Almost integers and other beasties
(02-10-2019 03:26 PM)Albert Chan Wrote:  
(02-10-2019 12:48 PM)Gerson W. Barbosa Wrote:  Number of iterations = Ceil(W(10^n*ln(2))/ln(2)), where n = number of digits and W(x) is the Lambert W function.

50 -> 1.0000000000012374125757361102287196106466728742977

Above 50 digits numbers are confirmed corrrect.
Can you explain how the iteration count formula is derived ?

Starting with log₁₀(k.2ᵏ) = n, I solved k.2ᵏ = 10ⁿ for k. Well, actually W|A did :-)

k = W(10ⁿ.ln(2))/ln(2)

BTW, it's better to replace ALOG 2 LN * LN with 10 LN * 2 LN LN + just in case you want to evaluate it to one thousand digits or more:

1000

\<< RCLF SWAP -105 CF -3 CF DUP 'DIGITS' STO 10 LN * 2 LN LN + DUP LN - LASTARG SWAP / + 2 LN / CEIL 0 1 ROT
FOR k 1 FNEG k FY\|^X k FDIV 2 k FY\|^X 1 FSUB FDIV FADD
NEXT DUP FADD 2 FLN FDIV 12 FINV FADD FPI FSQ 6 FDIV 2 FLN FSQ FDIV FADD ZZ\<-\->F NEG SWAP \->STR DUP SIZE ROT \=/ -51 FC? { "." } { "," } IFTE UNROT { DUP TAIL SWAP HEAD } { "0" } IFTE UNROT + + SWAP STOF
\>>

EVAL ->

1.000000000001237412575736110228719610646672874297732048196548443844171825640530​42885091388558619352497626845334008619165837450903001904672978600537014020759086​53972210668862091672466121582555971369478336628117111805015220469582973183869567​49813586119403326983996836799698362386464361717810944715248515847063950123049027​85528947933780707497372217486300760223459895208271343612686740722308571122141720​60133366839502480369120342433228486075440964655597427100579440680205978185469463​76873631661338090760132715563114425400886965240835824220034845681146540332945848​09115605566107380898677023776867118135971086811207980254600217139884419904867460​04071504113819770701596087697700373957210018691354928394481593778392574770677787​76337799415286212226231921875049198549974749265675547171167195366657491492695699​89391692666496234240604535789799813602754866102044836132703557955522820580941853​00921892327891632974811217666530275540985323109184583425808784453698915073727444​36069036208883146409368525831685839774710


(363.97 seconds on the emulator)

# B529h, 363 bytes
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] SRC#002- Almost integers and other beasties - Gerson W. Barbosa - 02-10-2019 04:06 PM



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