Golden Ratio Digits

Author

Eric W. Weisstein
September 14, 2013

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

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

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

Digit Computation

N[GoldenRatio,20]

Compute

(10^10)

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

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

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

DumpSave["/Developer/eww/Constants/GoldenRatio_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/GoldenRatio_10_10.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]

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

Get String from file

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

StringLength[string]

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

A224844

(10^10)

StringLength[string]

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

earls[[All,2]]

Scan until all n-digits strings have been found

?ScanDigitStrings

A000000/A000000

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

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

First digit string occurrences

A088577

Length[realdigits]

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

Take[f,100]

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

Specific Digits Runs

StringLength[string]

0123456789

StringPosition[string,"0123456789"]//Timing

9876543210

StringPosition[string,"9876543210"]//Timing