Euler-Mascheroni Constant Digits

Author

Eric W. Weisstein
September 14, 2013

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Constants/Euler-MascheroniConstantDigits.nb.

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

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

Digit Computation

N[EulerGamma,20]

Compute

(10^6)

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

gamma=N[EulerGamma,10^6];//Timing

DumpSave["/Developer/eww/Constants/EulerMascheroni_10_6.mx",gamma];

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

(10^7)

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

gamma=N[EulerGamma,10^7];//Timing

DumpSave["/Developer/eww/Constants/EulerMascheroni_10_7.mx",gamma];

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

(10^8)

{$TopDirectory,DateString[]}

gamma=N[EulerGamma,1*^8];//Timing

DumpSave["/Developer/eww/Constants/EulerMascheroni_10_8.mx",gamma];

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

(10^9)

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

gamma=N[EulerGamma,1*^9];//Timing

DumpSave["/Developer/eww/Constants/EulerGamma_10_9.mx",gamma];

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

5×(10^9)

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

cons=N[EulerGamma,5*^9];//Timing

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

Precision[cons]

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

Read from file

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

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

Convert to String

(10^9)

StringLength[string=StringDrop[ToString[cons],2]]//Timing

StringTake[string,10]

5×(10^9)

StringLength[string=StringDrop[ToString[cons],2]]//Timing

StringTake[string,10]//Timing

Save String to File

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

Get String from file

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

Pre-computed

g=Get["/Volumes/Users/Data/Math/EulerGamma116580041.txt"];//Timing

g=Get["~/mma/EulerGamma116580041.txt"];//Timing

Precision[g]

g1=Import["/Volumes/Users/Data/Math/EulerGamma116580041.txt","String"];//Timing

gstr=Import["/Volumes/Users/Data/Math/EulerGamma60M.txt","String"];

g2=StringTake[StringReplace[gstr,"\\\n"->""],All];//Timing

StringLength/@{g1,g2}

StringTake[g1,6 10^7+8]===StringTake[g2,6 10^7+8]//Timing

Plots

Binary Plot

<<Utilities`Plot`

binary represenation of the digits of K

Show[PixelPerfect[BasePlot[RealDigits[Catalan,10,255][[1]]],
BlockSize->2]]

decimal digits of K

Show[PixelPerfect[Transpose[Reverse/@(DigitCount[#,10]&/@RealDigits[Catalan,10,511][[1]])],
BlockSize->1]]

Base 10 (mod 2)

ArrayPlot[Partition[Mod[First[RealDigits[Catalan,10,1600]],2],40],Mesh->True,PixelConstrained->True,ImageSize->200]

ArrayPlot[Partition[Mod[First[RealDigits[22/7,10,1600]],2],40],Mesh->True,PixelConstrained->True,ImageSize->200]

Digit Distribution

(10^9)

StringLength[string]

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

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

Not yet added to OEIS

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

Digit Runs

k n’s

(10^9)

StringLength[string]

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

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

5×(10^9)

StringLength[string]

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

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

n n’s (Earls Sequence)

A224826

(10^9)

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

Length[earl]

earl[[All,2]]

Scan until all n-digits strings have been found

?ScanDigitStrings

A000000/A000000

Length[realdigits=RealDigits[EulerGamma,10,10^7][[1]]]//Timing

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

First digit string occurrences

A229192

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

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

Take[f,100]

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

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

Specific Digits Runs

0123456789

(10^9)

StringLength[string]

StringPosition[string,"0123456789"]//Timing

5×(10^9)

StringLength[string]

StringPosition[string,"0123456789"]//Timing

9876543210

(10^9)

StringLength[string]

StringPosition[string,"9876543210"]//Timing

5×(10^9)

StringLength[string]

StringPosition[string,"9876543210"]//Timing