Champernowne Constant Continued Fraction

Author

Eric W. Weisstein
August 20, 2013

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

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

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

Terms

ContinuedFraction[ChampernowneNumber[10],20]

ContinuedFraction[N[ChampernowneNumber[10],10^3],20]

IntegerLength/@ContinuedFraction[N[ChampernowneNumber[10],10^4],110]

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

ListPlot[Log10@l,PlotRange->All,Filling->Axis,AxesLabel->{n,HoldForm@Log10[Subscript[d,n]]}]

ListPlot[Log10@ContinuedFraction[N[ChampernowneNumber[10],10^4],110],PlotRange->All,Filling->Axis,AxesLabel->{n,HoldForm@Log10[Subscript[d,n]]}]

Computation

(10^8)

{DateString[],$TopDirectory,$MachineName}

{Length[cf=ContinuedFraction[N[ChampernowneNumber[],10^8]]]//Timing,{ByteCount[cf],MaxMemoryUsed[]}/10^6. MB}

(hwm=HighWaterMarks[cf])[[2]]-1

IntegerLength[hwm[[1]]]

(10^9)

{Length[cf=ContinuedFraction[N[ChampernowneNumber[],10^9]]]//Timing,MaxMemoryUsed[]/10^6. MB}

(hwm=HighWaterMarks[cf])[[2]]-1

IntegerLength[hwm[[1]]]

4×(10^9)

Record as of 4 Sep 2008

Date: Thu, 4 Sep 2008 17:29:09 -0500
From: Mark Sofroniou

I have computed the continued fraction for a four billion digit approximation to ChampernowneNumber in the 64 bit mint build without problem. Below is the result - I believe that the last term is new:

I think that the next term will be several billion digits and unfortunately there isn't enough memory on byblis65 to compute it.

5×(10^9)

{Length[cf=ContinuedFraction[N[ChampernowneNumber[],5 10^9]]]//Timing,MaxMemoryUsed[]/10^9. GB}

(hwm=HighWaterMarks[cf])[[2]]-1

IntegerLength[hwm[[1]]]

(10^10)

{DateString[],$TopDirectory,$MachineName}

{Length[cf=ContinuedFraction[N[ChampernowneNumber[],10^10]]]//Timing,{ByteCount[cf],MaxMemoryUsed[]}/10^9. GB}

...crash...

vmstat -t -a 60 | tee memory.log

Started about 1 hour in to constant computation; in half-minute increments

mem=ToExpression@Transpose[Take[#,{4,6}]&/@(StringSplit/@Select[Import["~/memory.log","Lines"],StringMatchQ[#," "~~DigitCharacter~~__]&])]

{
ListPlot[mem[[1]]/10^6.,PlotLabel->"free"],
ListPlot[mem[[2]]/10^6.,PlotLabel->"inact"],
ListPlot[mem[[3]]/10^6.,PlotLabel->"active"]
}

5×(10^10)

{DateString[],$TopDirectory,$MachineName}

ByteCount[c = N[ChampernowneNumber[], 5*^10]]/10^9. // Timing

MaxMemoryUsed[]/10^9. GB

mem=Take[#,700]&/@(ToExpression@Transpose[Take[#,{4,6}]&/@(StringSplit/@Select[Import["~/memory5.10.10.log","Lines"],StringMatchQ[#," "~~DigitCharacter~~__]&])])

{
ListPlot[mem[[1]]/10^6.,PlotLabel->"free"],
ListPlot[mem[[2]]/10^6.,PlotLabel->"inact"],
ListPlot[mem[[3]]/10^6.,PlotLabel->"active"]
}

DumpSave["~/champ.mx",c]

Get["~/champ.mx"]

ByteCount[c]

Precision[c]

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

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

mem=Take[#,All]&/@(ToExpression@Transpose[Take[#,{4,6}]&/@(StringSplit/@Select[Import["~/memory5.10.10-cf.log","Lines"],StringMatchQ[#," "~~DigitCharacter~~__]&])])

{
ListPlot[mem[[1]]/10^6.,PlotLabel->"free"],
ListPlot[mem[[2]]/10^6.,PlotLabel->"inact"],
ListPlot[mem[[3]]/10^6.,PlotLabel->"active"]
}

(hwm=HighWaterMarks[cf])[[2]]-1

IntegerLength[hwm[[1]]]

fo=FirstOccurrences[cf,200,Method->"LowMemory"]

p=Position[fo,0]//Flatten

Export["~/b038706.txt",MapIndexed[StringJoin@@Riffle[ToString/@{#2[[1]],#}," "]&,Take[fo,p[[1]]-1]]<>"\n","Lines"]

6×(10^10) (CF computation runs out of memory and crashes)

Get["/Developer/eww/Constants/ChampernowneConstant-6_10_10.mx"];//Timing

{ByteCount[c],Precision[c]}

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

...crash after ~140 min...

GNU MP: Cannot allocate memory (size=18446744058035666968)

mem=Take[#,All]&/@(ToExpression@Transpose[Take[#,{4,6}]&/@(StringSplit/@Select[Import["~/memory6.10.10-cf-2.log","Lines"],StringMatchQ[#," "~~DigitCharacter~~__]&])])

{
ListPlot[mem[[1]]/10^6.,PlotLabel->"free"],
ListPlot[mem[[2]]/10^6.,PlotLabel->"inact"],
ListPlot[mem[[3]]/10^6.,PlotLabel->"active"]
}

7×(10^10) (> 400 GB)

{DateString[],$TopDirectory,$MachineName}

ByteCount[c = N[ChampernowneNumber[], 5*^10]]/10^9. // Timing

MaxMemoryUsed[]/10^9. GB

mem=Take[#,All]&/@(ToExpression@Transpose[Take[#,{4,6}]&/@(StringSplit/@Select[Import["~/memory8.10.10.log","Lines"],StringMatchQ[#," "~~DigitCharacter~~__]&])])

{
ListPlot[mem[[1]]/10^6.,PlotLabel->"free"],
ListPlot[mem[[2]]/10^6.,PlotLabel->"inact"],
ListPlot[mem[[3]]/10^6.,PlotLabel->"active"]
}

8×(10^10) (> 400 GB)

{DateString[],$TopDirectory,$MachineName}

ByteCount[c = N[ChampernowneNumber[], 5*^10]]/10^9. // Timing

...crash...

mem=Take[#,All]&/@(ToExpression@Transpose[Take[#,{4,6}]&/@(StringSplit/@Select[Import["~/memory8.10.10.log","Lines"],StringMatchQ[#," "~~DigitCharacter~~__]&])])

{
ListPlot[mem[[1]]/10^6.,PlotLabel->"free"],
ListPlot[mem[[2]]/10^6.,PlotLabel->"inact"],
ListPlot[mem[[3]]/10^6.,PlotLabel->"active"]
}

(10^11) (> 400 GB)

{DateString[],$TopDirectory,$MachineName}

ByteCount[c = N[ChampernowneNumber[], 1*^11]]/10^9. // Timing

...crash...

High Water Marks

cf=ContinuedFraction[N[ChampernowneNumber[],10^5],20]

hwm=HighWaterMarks[cf];

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

IntegerLength[hwm[[1]]]

First Occurrence of n

fo={4,28,13,9,93,20,31,2,3,339,71,126,107,48,18,292,327,133,611,342,23,202,441,164,512,235,957,349,528,77,179,591,307,381,2011,245,2435,187,1870,117,1359,1071,762,4199,4309,2308,4294,1012,1501,3490,2249,283,166,40,729,313,6687,38,1006,6254,2829,7050,747,1552,1435,2559,4286,377,595,1536,813,104,150,14757,1847,6590,8197,11376,4492,15498,3389,3652,34,253,1471,2661,4318,5686,3027,8613,1626,19408,15250,1466,2555,7285,6913,281,5321,6797,19829,2362,2626,2701,562,30670,2223,29403,13920,1613,4579,8334,39042,7464,16650,19167,2152,5590,1352,2609,5636,3068,7428,8361,11004,6672,23913,2407,16163,13880,436,6600,6908,13762,19928,20041,9438,3714,8557,10620,19264,3651,61413,11420,6649,4266,3132,234,1749,25152,22056,14635,6414,419,58,36,1864,16274,637,14996,15564,7690,9551,2600,13569,2376,4909,53185,12707,8537,13296,19731,33688,17403,254,20830,899,48572,6167,6859,18765,10868,36185,12458,11293,72669,1171,0,16085,18539,0,47877,47015,1148,12149,25887,18191,1425,37835,0};

p=Position[fo,0]//Flatten

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

Conjectured form for number of digits in HWM

NCD[n_]:=3-n+Sum[9 m (10^(m-1)),{m,n-3}]

NCD[n]//FullSimplify

f[n_]:=NCD[n]-2NCD[n-1]-3(n-2)+4

l=Table[f[n],{n,4,12}]

A143534

A143534={0,1,1,6,166,2504,33102,411100,4911098,57111096,651111094,7311111092};

l-Drop[A143534,3]

Length[A143534]