Catalan’s Constant Digits

Author

Eric W. Weisstein
September 14, 2013

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

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

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

Digit Computation

N[Catalan,20]

(10^5)

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

Precision[cons=N[Catalan,1*^5]]//Timing

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

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

(10^6)

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

Precision[cons=N[Catalan,1*^6]]//Timing

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

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

(10^7)

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

Precision[cons=N[Catalan,1*^7]]//Timing

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

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

(10^8)

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

Precision[cons=N[Catalan,1*^8]]//Timing

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

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

(10^9)

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

Precision[cons=N[Catalan,1*^9]]//Timing

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

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

5×(10^9)

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

Precision[cons=N[Catalan,5*^9+10]]//Timing

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

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

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

N[Catalan]

StringTake[string,10]

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

Read from file

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

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

Get String from file

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

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

StringLength[string]

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

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

A224615 to A224818

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

Digit Runs

StringLength[string]

(10^9)

(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)

(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)

A224819

StringLength[string]

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

Length[earls]

Scan until all n-digits strings have been found

?ScanDigitStrings

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

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

First digit string occurrences

A100079

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

Take[f,100]

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

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

Specific Digits Runs

StringLength[string]

0123456789

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

9876543210

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