For 42K (run overnight), Function[cf, Take[cf, #] & /@ Echo@SequencePosition[cf, {Repeated[Except@1, {12, \[Infinity]}]}, Overlaps -> False]]@ContinuedFraction[\[Pi], 42000] // tim {{3191,3202},{3315,3326},{6778,6790},{10541,10553},{15805,15816},{18552,18563},{19005,19016},{20119,20130},{25511,25524},{28230,28243},{28877,28890},{31767,31778},{36912,36924},{39788,39800},{40482,40493},{40512,40525}} During evaluation of In[140]:= 69756.827088,16 Out[140]= {{2, 4, 2, 2, 32, 2, 4, 16, 3, 46, 2, 5}, {2, 33, 3, 3, 2, 3, 9, 6, 4, 4, 5, 7}, {32, 2, 2, 9, 3, 2, 3, 2, 5, 3, 3, 2, 54}, {2,3, 5, 2, 23, 5, 6, 2, 18, 4, 21, 3, 2}, {4, 4, 3, 5, 2, 224, 3, 10, 2, 2, 2, 4}, {11, 3, 3, 4, 5, 13, 3, 2, 4, 4, 4, 5}, {3, 9, 2, 3, 6, 2, 4, 5, 24, 2, 52, 2}, {8, 3, 10, 3, 2, 2, 2, 51, 2, 5, 6, 3}, {2, 3, 4, 2, 2, 3, 5, 3, 3, 3, 16, 2, 2, 3}, {3, 22, 19, 2, 5, 2, 7, 2, 5, 3, 2, 79, 213, 2}, {3, 186, 19, 2, 4, 15, 8, 24, 4, 2, 100, 2, 7, 5}, {2, 2, 2, 2, 2, 5, 158, 5, 9, 8, 3, 2}, {2, 6, 3, 2, 2, 5, 16, 4, 6, 13, 2, 3, 57}, {3, 3, 13, 2, 14, 4, 2, 5, 4, 25, 4,15, 2}, {8, 2, 2, 2, 25, 5, 2, 2, 2, 56, 5, 6}, {2, 3, 9, 8, 3, 4, 26, 2, 9, 2, 4, 2, 3, 2}} In[141]:= Length /@ % Out[141]= {12, 12, 13, 13, 12, 12, 12, 12, 14, 14, 14, 12, 13, 13, 12, 14} No (15)s. On Sun, Dec 9, 2018 at 4:36 AM Bill Gosper <billgosper@gmail.com> wrote:
The 1-free bursts of length ≥12 in the first thirty thousand terms of π:
Function[cf, Take[cf, #] & /@ Echo@SequencePosition[cf, {Repeated[Except@1, {12, ∞}]}, Overlaps -> False]]@ContinuedFraction[π, 29999] // tim
{{3191,3202},{3315,3326},{6778,6790},{10541,10553},{15805,15816},{18552,18563},{19005,19016},{20119,20130},{25511,25524},{28230,28243},{28877,28890}}
During evaluation of In[138]:= 23257.343155,11 (* ~7 hrs. I hope WRI gets around to speeding this up.*)
I BCCed Wolfram Tech Support and they helpfully sent a half-millionfold faster solution. But I still think they need to fix the cubic time complexity of the direct solution.
{{2, 4, 2, 2, 32, 2, 4, 16, 3, 46, 2, 5}, {2, 33, 3, 3, 2, 3, 9, 6, 4, 4, 5, 7}, {32, 2, 2, 9, 3, 2, 3, 2, 5, 3, 3, 2, 54}, {2,3, 5, 2, 23, 5, 6, 2, 18, 4, 21, 3, 2}, {4, 4, 3, 5, 2, 224, 3, 10,2, 2, 2, 4}, {11, 3, 3, 4, 5, 13, 3, 2, 4, 4, 4, 5}, {3, 9, 2, 3, 6, 2, 4, 5, 24, 2, 52, 2}, {8, 3, 10, 3, 2, 2, 2, 51, 2, 5, 6, 3}, {2, 3, 4, 2, 2, 3, 5, 3, 3, 3, 16, 2, 2, 3}, {3, 22, 19, 2, 5, 2, 7, 2, 5, 3, 2, 79, 213, 2}, {3, 186, 19, 2, 4, 15, 8, 24, 4, 2, 100, 2, 7, 5}} with lengths 1 - Subtract @@ # & /@ {{3191, 3202}, {3315, 3326}, {6778, 6790}, {10541, 10553}, {15805, 15816}, {18552, 18563}, {19005, 19016}, {20119, 20130}, {25511, 25524}, {28230, 28243}, {28877, 28890}}
{12, 12, 13, 13, 12, 12, 12, 12, 14, 14, 14}
Gaa, why on Earth didn't I just Length /@% ?? —rwg
14, 14, 14? Wow. God's message? "Guys, you'll *never* figure this out." —rwg
On Sat, Dec 8, 2018 at 8:25 PM Bill Gosper <billgosper@gmail.com> wrote:
Reiterating, for a burst of terms L := {a, b, . . .}, the Gauss-Kuzmin distribution predicts a probability of
cfprob[L_List] := Abs@Log[2, (1 + 1/FromContinuedFraction@L)/(1 + 1/FromContinuedFraction@MapAt[# + 1 &, L, -1])] or cfprob[r : (Integer_ | Rational_)] := cfprob@ContinuedFraction@r where r := a+1/(b + 1/. . . ) I neglected to compare the probability of . . . /(1+1/(2 + 1/(3 +. . .)))
cfprob@{1, 2, 3}
Log[221/220]/Log[2]
N@%
0.00654284586677209
against the similar but incorrect
cfprob /@ Range@3
{Log[4/3]/Log[2], Log[9/8]/Log[2], Log[16/15]/Log[2]}
Times @@ % // N
0.00656656380451684
assuming that those three probabilities were independent. Since Log[4/3]/Log[2] ~ 41% of π's terms ought to be 1, let's find in π some bursts of at least a dozen non-1s:
Function[cf, Take[cf, #] & /@ Echo@SequencePosition[cf, {Repeated[Except@1, {12, \[Infinity]}]}, Overlaps -> False]]@ContinuedFraction[\[Pi], 9999] // tim
{{3191,3202}, {3315,3326}, {6778,6790}}
During evaluation of In[136]:= 1058.655331 (*secs, almost prohibitive *), 3
{{2, 4, 2, 2, 32, 2, 4, 16, 3, 46, 2, 5}, {2, 33, 3, 3, 2, 3, 9, 6, 4, 4, 5, 7}, {32, 2, 2, 9, 3, 2, 3, 2, 5, 3, 3, 2, 54}}
The same computation extended to the bursts ≥13 of non-1s among 99999 terms has thus far consumed most of a day. (Veridically prohibitive.) (Small scale experiments just now suggest that the time complexity is *worse* than cubic! Time to back off. 30000 should run overnight.) —rwg