Natural Logarithm of 2 Digits

Author

Eric W. Weisstein
September 14, 2013

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Constants/NaturalLogarithmof2Digits.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/NaturalLogarithmof2Digits.html.

©2013 Wolfram Research, Inc. except for portions noted otherwise

Digits

(10^6)

{$MachineName,$TopDirectory,$Version,DateString[]}//Column

Precision[cons=N[Log[2],1*^6+10]]//Timing

{ByteCount[cons],MaxMemoryUsed[]}/10^6.MB

DumpSave["/Developer/eww/Constants/Log2_10_6.mx",cons];

StringLength[string=StringTake[ToString[cons],{3,-3}]]//Timing

StringTake[string,10]

DumpSave["/Developer/eww/DigitStrings/Log2_10_6.mx",string];

(10^9)

{$MachineName,$TopDirectory,$Version,DateString[]}//Column

Precision[cons=N[Log[2],1*^9+10]]//Timing

{ByteCount[cons],MaxMemoryUsed[]}/10^9.GB

DumpSave["/Developer/eww/Constants/Log2_10_9.mx",cons];

StringLength[string=StringTake[ToString[cons],{3,-3}]]//Timing

StringTake[string,10]

DumpSave["/Developer/eww/DigitStrings/Log2_10_9.mx",string];

(10^10)

{$MachineName,$TopDirectory,$Version,DateString[]}//Column

Precision[cons=N[Log[2],1*^10+10]]//Timing

{ByteCount[cons],MaxMemoryUsed[]}/10^9.GB

DumpSave["/Developer/eww/Constants/Log2_10_10.mx",cons];

StringLength[string=StringTake[ToString[cons],{3,-3}]]//Timing

StringTake[string,10]

DumpSave["/Developer/eww/DigitStrings/Log2_10_10.mx",string];

Digit Distribution

StringLength[string]

StringPartition[s_String,chunksize_]:=Module[{len=StringLength[s],k},If[chunksize>len,{s},StringTake[s,#]&/@Table[{1+(k-1) chunksize,Min[len,k chunksize]},{k,Ceiling[len/chunksize]}]]]

BigStringCount[s_,c_,chunksize_:((2^31)-1)]:=Total[StringCount[#,c]&/@StringPartition[s,chunksize]]

(digits=Table[{n,BigStringCount[StringTake[string,10^n],#]&/@CharacterRange["0","9"]},{n,IntegerLength[StringLength[string]]-1}])//Timing

Grid[digits,Dividers->All,Alignment->Left]

MapIndexed[{#2[[1]]-1,#}&,Transpose[digits[[All,2]]]]

Digit Runs

StringLength[string]

k n’s

data=Flatten[Table[{d,n,If[#=={},0,First[#]]&/@StringPosition[string,StringJoin@@Table[ToString[d],{n}],10]},{d,0,9},{n,15}],1];//Timing

Grid[DeleteCases[data,{_,_,{}}],Dividers->All,Alignment->Left]

n n’s (Earls Sequence)

earls=Cases[DeleteCases[data,{_,_,{}}],{x_,x_,s_}:>{x,s[[1]]}]

earls[[All,2]]

Scan until all n-digits strings have been found

?ScanDigitStrings

A036905

A036901

Length[realdigits=RealDigits[Log[2],10,10^8][[1]]]//Timing

Do[Print[{n,ScanDigitStrings[realdigits,n]//Timing}],{n,9}]

First digit string occurrences

A100077

Length[realdigits=RealDigits[Log[2],10,10^6][[1]]]//Timing

Length[f=FirstDigitOccurrences[realdigits,5]]//Timing

Take[f,100]

Length[f=FirstDigitOccurrences[realdigits,6]]//Timing

Take[Position[f,0],10]//Flatten

Specific Digits Runs

StringLength[string]

0123456789

StringPosition[string,"0123456789"][[All,1]]//Timing

9876543210

A101816

StringPosition[string,"9876543210"][[All,1]]//Timing