Apéry’s Constant Continued Fraction

Author

Eric W. Weisstein
September 17, 2013

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

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

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

Compute

SetDirectory["/Developer/eww"];

(10^7)

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

DumpSave["ContinuedFractions/Zeta3_"<>ToString[Length[cf]]<>".mx",cf];

(10^8)

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

DumpSave["ContinuedFractions/Zeta3_"<>ToString[Length[cf]]<>".mx",cf];

(10^9)

Precision[cons]

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

DumpSave["ContinuedFractions/Zeta3_"<>ToString[Length[cf]]<>".mx",cf];

Read Constant

FileNames["Constants/Zeta*"]

Get[%[[-1]]];

Precision[cons]

Read ContinuedFraction

FileNames["ContinuedFractions/Zeta*"]

Get[%[[-1]]];

Length[cf]

HighWaterMarks

A033166/A229055

Length[cf]

Take[cf,10]

(hwm=HighWaterMarks[cf,0])//Timing

First Occurrences

A229057

Length[cf]

Take[cf,10]

fo=FirstOccurrences[cf,0];//Timing

Length[fo]

Take[fo,100]

Length[p=Position[fo,-1]//Flatten]//Timing

Take[p,10]

<<Utilities`EISFormat`

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

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

n-Digit Terms

Length[cf]

ByteCount[cf]

digs=IntegerLength[cf];//Timing

Developer`PackedArrayQ[digs]

(max=Max[digs])//Timing

positions=Table[Flatten[Position[digs,n,1,20]],{n,max}];//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=Zeta[3]},
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]