In[]:=
Print["Start time is ",ds=DateString[],"."];prec=5000;(**Numberofrequireddecimals.*.*)ClearSystemCache[];T0=SessionTime[];expM[pre_]:=Module[{a,d,s,k,bb,c,end,iprec,xvals,x,pc,cores=32(*=4*numberofphysicalcores*),tsize=2^7,chunksize,start=1,ll,ctab,pr=Floor[1.005pre]},chunksize=cores*tsize;n=Floor[1.32pr];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/27];Do[xvals=Flatten[ParallelTable[Table[ll=start+j*tsize+l;x=N[E^(Log[ll]/(ll)),iprec];pc=iprec;While[pc<pr,pc=Min[3pc,pr];x=SetPrecision[x,pc];y=x^ll-ll;x=x(1-2y/((ll+1)y+2llll));];(**N[Exp[Log[ll]/ll],pr]**)x,{l,0,tsize-1}],{j,0,cores-1},Method"EvaluationsPerKernel"64(*apowerof2commensuratewithprocessorstrength*)]];ctab=ParallelTable[Table[c=b-c;ll=start+l-2;b*=2(ll+n)(ll-n)/((ll+1)(2ll+1));c,{l,chunksize}],Method"EvaluationsPerKernel"16(*apowerof2commensuratewithprocessorstrength*)];s+=ctab.(xvals-1);start+=chunksize;st=SessionTime[]-T0;kc=k*chunksize;ti=(st)/(kc+10^-4)*(n)/(3600)/(24);If[kc>1,Print[kc," iterations done in ",N[st,3]," seconds."," Should take ",N[ti,2]," days or ",N[ti*24*3600,2],"s, finish ",DatePlus[ds,ti],"."]];,{k,0,end-1}];N[-s/d,pr]];t2=Timing[MRBtest2=expM[prec];];Print["Finished on ",DateString[],". Processor time was ",t2[[1]]," s. Actual time was ",SessionTime[]-T0,"."];(*Print[*)MRBtest2(*]*)(*Remove(**)orenterMRBtest2toprintoutput*);Print["Enter MRBtest2 to print ",Floor[Precision[MRBtest2]]," digits"];Print["If you saved m3M, the difference between this and 3,014,991 known digits is ",N[MRBtest2-m3M,10]];Print[];Print[];Print[];Print[];Print[];Pause[60];Print["Start time is ",ds=DateString[],"."];prec=2000;(**Numberofrequireddecimals.*.*)ClearSystemCache[];T0=SessionTime[];expM[pre_]:=Module[{a,d,s,k,bb,c,end,iprec,xvals,x,pc,cores=32(*=4*numberofphysicalcores*),tsize=2^7,chunksize,start=1,ll,ctab,pr=Floor[1.005pre]},chunksize=cores*tsize;n=Floor[1.32pr];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/27];Do[xvals=Flatten[ParallelTable[Table[ll=start+j*tsize+l;x=N[E^(Log[ll]/(ll)),iprec];pc=iprec;While[pc<pr,pc=Min[3pc,pr];x=SetPrecision[x,pc];y=x^ll-ll;x=x(1-2y/((ll+1)y+2llll));];(**N[Exp[Log[ll]/ll],pr]**)x,{l,0,tsize-1}],{j,0,cores-1},Method"EvaluationsPerKernel"64(*apowerof2commensuratewithprocessorstrength*)]];ctab=ParallelTable[Table[c=b-c;ll=start+l-2;b*=2(ll+n)(ll-n)/((ll+1)(2ll+1));c,{l,chunksize}],Method"EvaluationsPerKernel"16(*apowerof2commensuratewithprocessorstrength*)];s+=ctab.(xvals-1);start+=chunksize;st=SessionTime[]-T0;kc=k*chunksize;ti=(st)/(kc+10^-4)*(n)/(3600)/(24);If[kc>1,Print[kc," iterations done in ",N[st,3]," seconds."," Should take ",N[ti,2]," days or ",N[ti*24*3600,2],"s, finish ",DatePlus[ds,ti],"."]];,{k,0,end-1}];N[-s/d,pr]];t2=Timing[MRBtest2=expM[prec];];Print["Finished on ",DateString[],". Processor time was ",t2[[1]]," s. Actual time was ",SessionTime[]-T0,"."];(*Print[*)MRBtest2(*]*)(*Remove(**)orenterMRBtest2toprintoutput*);Print["Enter MRBtest2 to print ",Floor[Precision[MRBtest2]]," digits"];Print["If you saved m3M, the difference between this and 3,014,991 known digits is ",N[MRBtest2-CMRB,10]];Print[];Print[];Print[];Print[];Print[];
Start time is Thu 7 Jul 2022 00:49:57.
Iterations required: 6631
Will give 2 time estimates, each more accurate than the previous.
Will stop at 8192 iterations to ensure precsion of around 5024 decimal places.
4096 iterations done in 1.16 seconds. Should take 0.000022 days or 1.9s, finish Thu 7 Jul 2022 00:49:58.
Finished on Thu 7 Jul 2022 00:49:58. Processor time was 1. s. Actual time was 1.1579178.
Enter MRBtest2 to print 5019 digits
If you saved m3M, the difference between this and 3,014,991 known digits is 0.1878596425-1.000000000m3M
Start time is Thu 7 Jul 2022 00:50:58.
Iterations required: 2651
Will give 1 time estimates, each more accurate than the previous.
Will stop at 4096 iterations to ensure precsion of around 2009 decimal places.
Finished on Thu 7 Jul 2022 00:50:59. Processor time was 0.265625 s. Actual time was 0.3088932.
Enter MRBtest2 to print 2004 digits
If you saved m3M, the difference between this and 3,014,991 known digits is 0.1878596425-1.000000000CMRB