Message Boards Message Boards

Please speed up MRB constant program [open challenge]

I've been working on tweaking the late Richard Crandall's code for calculating many digits of the MRB constant since 2012.

I don't expect anyone else to understand the algorithms as much as I do. (My hat's off to you if you do!!!!!! and I would be thankful for your or anyone else's help.)

I started to pay a fortune for coding help, but I thought I would give the community a chance first. It would cost $800.00 just for them to work 4 hours, probably doing little more than understanding the algorithms used.

In short, it uses my shortcut of Cohen's Algorithm 1 found here and three different algorithms to calculate Exp[Log[x]/x] i.e. x^(1/x). The first one is simply Mathematica's command. The last two are optimized for calculating more and more digits. They are faster than Newton's method for many digits! There is an undocumented use of ParallelTable (the second occurrence) which I found to speed up the code significantly!

For one thing, I was hoping someone could look at my looping (Do, the tables, While, etc) and see if you can make the program for 50,000 then 100,000+ digits run faster that way? There are two separate tables and for 50,000+ digits, my computer spends around 40-45% of the time idle!!!! I think if both can be put into one table it will spend less time idle.

For another thing, there is a second algorithm in the above Cohen link that converges with less error per iteration that I plan on trying. (I haven't worked too much on it yet because I don't understand it, but I am still looking into it.) Any help here would be great.

I will give you a great amount of credit for any help that I can use!!!!!!!!!!!!

This is code is the essence of all versions I use to break MRB constant world records!

(I only repeat parts for calculating "N[Exp[Log[ll]/ll],pr]" a number of times for a minimum computation time. Lately, I also have began changing to options for the ParallelTable commands.)

If you make an improvement in this code, I will give you a fair amount of credit in all my future computations with it, like I still do for Crandall.

For checking purposes, this program uses "m3M." More than 3 million digits of m3M, (2 million + of which have been verified), are found at http://marvinrayburns.com/3M.txt . You can import the file into Mathematica, remove the string-quotes (if they appear before and after the text) and evaluate the cell to get m3M.

The denominator for Cohen's algorithm and the needed 65536 iterations are done in 295.6 seconds on my swiftest computer. While troubleshooting, I've found it useful to reduce the numer of desired digits to 10000. Also when running these parallel tables from a fresh kernel initialization, it is good to reduce the digits to 1000, and then increase it to your desired level, because it takes 1 to a few seconds to initialize all the kernels.

If you are using the Wolfram Cloud, you might have to remove the remarks.

I suggest that in one notebook you enter the

Import["http://marvinrayburns.com/3M.txt"]

and in another notebook enter the code:

  Print["Start time is ", ds = DateString[], "."];
prec = 50000;
(**Number of required decimals.*.*)ClearSystemCache[];
T0 = SessionTime[];
expM[pre_] :=

  Block[

   {a, d, s, k, bb, c, end, iprec, xvals, x, pc, cores = 16(*=4*
    number of physical cores*), tsize = 2^7, chunksize, start = 1, ll,
     ctab, pr = Floor[1.003 pre]}, chunksize = cores*tsize;
   n = Floor[1.32 pr];
   end = Ceiling[n/chunksize];
   Print["Iterations required: ", n];
   Print["Will give ", end, 
    " time estimates, each more accurate than the previous."];
   Print["Will stop at ", end*chunksize, 
    " iterations to ensure precsion of around ", pr, 
    " decimal places."];


   d = ChebyshevT[n, 3];
   {b, c, s} = {SetPrecision[-1, 1.1*n], -d, 0};
   iprec = Ceiling[pr/108];

   With[{$t = tsize - 1, $c = cores - 1, $ch = chunksize},

    Do[


     xvals = Flatten[ParallelTable[Table[ll = start + j*tsize + l;
         x = N[ll^(1/ll), iprec];
         pc = iprec;



         While[pc < pr/4, pc = Min[3 pc, pr/4];
          x = SetPrecision[x, pc];
          SetPrecision[y = x^ll - ll;
           x = x (1 - 2 y/((ll + 1) y + 2 ll ll));, pc]];(**N[Exp[Log[
         ll]/ll],pr/4]**)






         x = SetPrecision[x, pr];
         SetPrecision[xll = x^ll; z = (ll - xll)/xll;
          t = 2 ll - 1; t2 = t^2;

          x *= (1 + 45/10 (ll - 1)/t2 + (ll + 1) z/(2 ll t) - 
             135/10 ll (ll - 1) 1/(3 ll t2 + t^3 z)), pr];(**N[Exp[
         Log[ll]/ll],pr]**)







         x, {l, 0, $t}], {j, 0, $c}, 
        Method -> "EvaluationsPerKernel" -> 32]];



     ctab = ParallelTable[Table[c = b - c;
        ll = start + l - 2;
        b *= 2 (ll + n) (ll - n)/((ll + 1) (2 ll + 1));
        c, {l, $ch}], Method -> "EvaluationsPerKernel" -> 16];


     s += ctab.(xvals - 1);
     start += chunksize;
     st = SessionTime[] - T0; kc = k*chunksize;
     ti = (st)/(kc + 10^-10)*(n)/(3600)/(24);



     If[kc > 1, 
      Print["Denominator and ", kc, " iterations done in ", N[st, 4], 
       " seconds.", " Should take ", N[ti, 4], " days or ", 
       N[ti*24*3600, 4], "s, finish ", DatePlus[ds, ti], "."], 
      Print["Denominator for acceleration method calculated in ", st, 
       " s."]];(*I want to keep all progress stats, 
     but making them faster is fine!*)


     , {k, 0, end - 1}](*End of Do*)];


   N[-s/d, pr] 

   ];(* End of Block*)




t2 = Timing[MRBtest2 = expM[prec];]; Print["Finished on ", 
 DateString[], ". Processor time and absolute time were ", 
 t2[[1]], " and ", st, "s, respectively."];
(*Print[MRBtest2];*)Print["Enter MRBtest2 to print ", 
 Floor[Precision[
   MRBtest2]], " digits"]; Print["If you saved m3M, the difference \
between this and 3,000,000+ known digits is ", N[MRBtest2 - m3M, 10]]
POSTED BY: Marvin Ray Burns
5 Replies

I was a D and F student through sixth grade the second time but now get no greater enjoyment than trying to find anything new or interesting about math in general and especially the MRB constant!!

POSTED BY: Marvin Ray Burns

I don't see their reply, but someone wrote the following:

Marvin,

I apologize in advance for my lack of knowledge in this area but What is the application of this constant? Is there a physical meaning? In What field does it get used? This info might help in suggesting alternative approaches. Also for what applications do you need so many digits?

Regards,

To the best of my understanding the greatest placing of the MRB constant with other mathematical constants and mathematical operations is achieved when you compare its "alternating zeta" summation,

MRB=enter image description here

to other zeta variants, as the late Richard Crandal did here.

I first dreamed of this constant,

MRB=enter image description here,

after seeing record digits of other constant's like Sqrt[2], or perhaps like 3^(1/3), which happen to be examples of n^(1/n)|n=positive integers, I wondered what happens when you add all the n^(1/n)|n=positive integers, up in an alternating series? I found that is a divergent series whose upper and lower limit points are MRB and MRB-1, respectively. So what is so neat about calculating many digits of MRB is you are actually calculating the digits of very many integer roots of themselves!! You see, MRB converges so slow that it takes 10^(n+1) iterations of n^(1/n) to produce n digits of MRB. (Think about that for a while!!) So when you calculate over 3,000,000 digits of MRB, like I did, you are in effect calculating 10^(3,000,001) roots to 3 million digits each!! You can do that by the power of the acceleration of the numerical series.

All of the physical world applications that I came up with are somewhat imagination driven such as the growth rate that causes an initial population to grow k times in k periods, or the geometric interpretation of MRB here.

Please ask more questions to keep me on track and I will try to give more answers!!!!

POSTED BY: Marvin Ray Burns

Marvin,

I apologize in advance for my lack of knowledge in this area but What is the application of this constant? Is there a physical meaning? In What field does it get used? This info might help in suggesting alternative approaches. Also for what applications do you need so many digits?

Regards,

Neil

POSTED BY: Neil Singer

It's been a while since I asked!

**

Can anyone help me speed up the MRB constant code?

**

POSTED BY: Marvin Ray Burns

I made some presentation edits to the above code. Also tried to clarify the instructions.

Please ask if you have any questions!

POSTED BY: Marvin Ray Burns
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract