Golomb-Dickman Constant Continued Fraction

Author

Eric W. Weisstein
July 25, 2013

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Constants/Golomb-DickmanConstantContinuedFraction.nb.

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

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

Terms

ContinuedFraction[cons,110]

1/(1+1/(1+1/(1+1/(22+1/(1)))))//N

N[cons]

Count[cf1=ContinuedFraction[cons],1]/Length[Rest@cf1]100.

Count[cf1=ContinuedFraction[cons],2]/Length[Rest@cf1]100.

Count[cf1=ContinuedFraction[cons],3]/Length[Rest@cf1]100.

Compute

Read constant

Precision[cons=MathConstant["GolombDickman"]]

Compute

15000

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

N[cons]

Precision[cons]

Length[cf=ContinuedFraction[cons]]//Timing

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

DumpSave["/Developer/eww/ContinuedFractions/GolombDickman_14510.mx",cf];

Plot

With[{l=Take[cf,10^3]},
GraphicsRow[{ListPlot[l,Filling->Axis],ListPlot[l,Filling->Axis,PlotRange->All]}]
]

l2=IntegerLength[ContinuedFraction[N[ChampernowneNumber[10],5*^7],2000]];//Timing

High Water Marks

15000

Length[cf]

(hwm=HighWaterMarks[cf]);//Timing

Take[cf,20]

{hwm[[1]],hwm[[2]]-1}

Length/@hwm

First Occurrences

15000

Length[cf]

fo=FirstOccurrences[cf];//Timing

p=Take[Position[fo,0],10]//Flatten

Take[fo,20]-1

Take[fo,89]-1

Take[cf,20]

BFile["~/b225364.txt",Take[fo,p[[1]]-1]-1]

ListPlot[Take[fo,p[[1]]-1]-1,AxesLabel->{Subscript[a,n],n},PlotRange->All]

Clear[fo]

n-Digit Terms

15000

Length[cf]

digs=IntegerLength[cf];//Timing

Max[digs]//Timing

positions=Table[Flatten[Position[digs,n,1,20]],{n,6}];//Timing

data=MapIndexed[{#2[[1]],{#,cf[[#]]}}&,positions]

Grid[{#[[1]],Column@#[[2]]}&/@data,Dividers->All,Alignment->Left]

Khinchin and Lévy Constant

KhinchinList[x_,n_:200]:=MapIndexed[#1^(1/#2[[1]])&,Rest@FoldList[Times,1,Rest[ContinuedFraction[Mod[x,1],n+1]]]]
LevyList[x_,n_:200]:=MapIndexed[#1^(1/#2[[1]])&,Denominator/@FromContinuedFraction/@Reverse[NestList[Drop[#,-1]&,Rest[ContinuedFraction[Mod[x,1],n+1]],n]]]

<<Utilities`Typesetting`

With[{k=5000,c=cons},
g1=ListPlot[KhinchinList[c,k],Joined->True,PlotStyle->Red,AxesLabel->{n,((Subscript[a, 1])(Subscript[⋯a, n]))^InlineFraction[1,n]},
PlotLabel->"Khinchin's constant",
Epilog->{Blue,Dashing[{.02}],Line[{{0,#},{k,#}}]&[2.685452001]}];
g2=ListPlot[LevyList[c,k],Joined->True,PlotStyle->Red,AxesLabel->{n,(Subscript[q, n])^InlineFraction[1,n]},
PlotLabel->"Lévy constant",
Epilog->{Blue,Dashing[{.02}],Line[{{0,#},{k,#}}]&[Exp[Pi^2/12/Log[2]]]}
];
];//Timing

GraphicsRow[{g1,g2},Spacings->-50,ImageSize->400]