Theodorus’s Constant Digits

Author

Eric W. Weisstein
September 14, 2013

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

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

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

Digit Computation

N[Sqrt[3],20]

Compute

(10^10)

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

Precision[cons=N[Sqrt[3],1*^10+10]]//Timing

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

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

(10^11)

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

Precision[cons=N[E,1*^11+10]]//Timing

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

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

Read from file

Get["/Developer/eww/Constants/E_10_9.mx"];//Timing//AbsoluteTiming

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

Convert to String

(10^10)

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

StringTake[string,10]

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

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

Get String from file

Get["/Developer/eww/DigitStrings/E_10_9.mx"];//Timing//AbsoluteTiming

Digit Distribution

(10^10) manually partitioning 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,10}])//Timing

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

A224615 to A224818

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

Digit Runs

k n’s

(10^10)

StringLength[string]

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

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

n n’s (Earls Sequence)

A224819

(10^10)

StringLength[string]

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

earls[[All,2]]

Length[earls]

Scan until all n-digits strings have been found

?ScanDigitStrings

A000000/A000000

Length[realdigits=RealDigits[Sqrt[3],10,10^8][[1]]]//Timing

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

First digit string occurrences

A000000

Length[realdigits=RealDigits[Sqrt[3],10,10^6][[1]]]//Timing

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

Take[f,100]

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

BFile["~/b229200.txt",Take[f,1000],0]

Specific Digits Runs

StringLength[string]

0123456789

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

9876543210

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