[ prog / sol / mona ]

prog


LISP Puzzles

100 2020-05-18 01:57

>>99
I look forward to seeing it!

101 2020-05-19 00:10

[1/14]
Here is the upgraded version of >>76 using stacked self-generation >>35 of the S sequence and layered >>81 partial >>72 fourth-order S-groups >>35 to achieve O(log(log(n))) space consumption and O(n^(1/16)) runtime >>86. Fourth-order S-group formulas were obtained from the general procedure for incrementing the S-group order. To avoid shifting in the main loop the Svec of >>83 is reversed so the 's' value is at index 0. The new Slist is [s, S1, S2 ...] and holds the starting values of the S-groups from the one with the highest order, which is furthest from the base S sequence, to the one with the lowest order, which is closest to the base S sequence, and ending with the S sequence itself. With layers numbered from 1, the first equation that defines the general procedure is:
layer[N+1].count(c,Slist) = layer[N].inc(c,Slist')
where Slist' is Slist with the value at index N-1 decremented. The [N+1].inc equation can be obtained by expressing the [N+2].count both in terms of [N+1].inc and as a sum of the component [N+1].counts:
layer[N+1].inc(c,Slist') = sum(for j in [1...c] of layer[N+1].count(s-2+j,h(j,Slist)))
where h advances the values of Slist[k in 0...N-1] for subgroup j:
h[k](j,Slist) = Slist[k+1]+layer[k+1].inc(j-1,Slist)
One thing that saves on computations is to note that Slist[N] need not be included in the final h because it is a foregone conclusion that in the final result it will appear as a linear term, and its factor will be the full count in the same layer. Implementing these as well as the previous observations yields:

class Layer:
   @ classmethod
   def count (cls, c, Slist, counts, incs):
      pass

   @ classmethod
   def increment (cls, c, Slist, counts, incs):
      pass

class ChainedLayers:
   class Layer1 (Layer):
      @ classmethod
      def count (cls, c, Slist, counts, incs):
         counts [0] = c

      @ classmethod
      def increment (cls, c, Slist, counts, incs):
         s = Slist [0]
         incs [0] = (c - 1 + s + s) * c // 2

   def _access (setasup):
      def fun (cls):
         cls.up = setasup.increment
         return cls
      return fun

   @ _access (Layer1)
   class Layer2 (Layer):
      @ classmethod
      def count (cls, c, Slist, counts, incs):
         s = Slist [0]
         # Slist [0] = s - 1
         # cls.up (c, Slist, counts, incs)
         # Slist [0] = s
         # counts [1] = incs [0]
         counts [1] = (c - 3 + s + s) * c // 2

      @ classmethod
      def increment (cls, c, Slist, counts, incs):
         countS = counts [1]
         incS   = countS + c
         s      = Slist [0]
         overR  = (incS - 1) * incS // 2
         cm1c   = (c - 1) * c
         backR  = (s - 1) * c + (c + 1 + 3 * s) * cm1c // 6
         incR   = overR - backR + Slist [1] * countS
         incs [0] = incS
         incs [1] = incR

   @ _access (Layer2)
   class Layer3 (Layer):
      @ classmethod
      def count (cls, c, Slist, counts, incs):
         S = Slist [1]
         Slist [1] = S - 1
         cls.up (c, Slist, counts, incs)
         Slist [1] = S
         counts [2] = incs [1]

      @ classmethod
      def increment (cls, c, Slist, counts, incs):
         # names from seq4_inc
         countS1 = counts [1]
         countS0 = counts [2]
         incS0   = countS0 + countS1
         overR   = (incS0 - 1) * incS0 // 2
         s       = Slist [0]
         s20     = 20 * s
         s30     = 30 * s
         s60     = s30 + s30
         backR   = c*(((((5*c + (s30 - 29))*c + ((s60 - 130)*s + 45))*c + (((s20 + s20 - 140)*s + 90)*s + 85))*c + ((250 - s60)*s - 290))*c + (s20 - 160)*s + 184) // 240
         backR   = countS1 * (countS1 + 1) // 2 * Slist [1] - countS1 + backR
         incR    = overR - backR + Slist [2] * countS0
         incs [1] = incS0
         incs [2] = incR
102 2020-05-19 00:12

[2/14]

   @ _access (Layer3)
   class Layer4 (Layer):
      @ classmethod
      def count (cls, c, Slist, counts, incs):
         S = Slist [2]
         Slist [2] = S - 1
         cls.up (c, Slist, counts, incs)
         Slist [2] = S
         counts [3] = incs [2]

      @ classmethod
      def increment (cls, c, Slist, counts, incs):
         # s A B C
         countB = counts [2]
         countC = counts [3]
         incC   = countC + countB
         s      = Slist [0]
         A      = Slist [1]
         B      = Slist [2]
         part1  = A*(A*(A*(A*c**3*(c*(c*(c*(3628800*c + 29030400*s - 43545600) + s*(87091200*s - 261273600) + 195955200) + s*(s*(116121600*s - 522547200) + 783820800) - 391910400) + s*(s*(s*(58060800*s - 348364800) + 783820800) - 783820800) + 293932800) + c**2*(c*(c*(c*(c*(c*(c*(3628800*c + 36288000*s - 44755200) + s*(145152000*s - 362880000) + 195955200) + s*(s*(290304000*s - 1103155200) + 1175731200) - 263692800) + s*(s*(s*(290304000*s - 1490227200) + 2264371200) - 667699200) - 572140800) + s*(s*(s*(s*(116121600*s - 754790400) + 1219276800) + 754790400) - 3476390400) + 2340576000) + s*(s*(s*(-348364800*s + 2070835200) - 5080320000) + 5965747200) - 2743372800) + s*(s*(-309657600*s + 1393459200) - 2090188800) + 1045094400)) + c*(c*(c*(c*(c*(c*(c*(c*(c*(c*(1360800*c + 16329600*s - 17236800) + s*(81648000*s - 175996800) + 74239200) + s*(s*(217728000*s - 718502400) + 596332800) - 57093120) + s*(s*(s*(326592000*s - 1466035200) + 1735776000) - 52980480) - 518222880) + s*(s*(s*(s*(261273600*s - 1495065600) + 2036966400) + 1269112320) - 3868421760) + 1589353920) + s*(s*(s*(s*(s*(87091200*s - 609638400) + 462067200) + 3914265600) - 9503222400) + 6943708800) - 754034400) + s*(s*(s*(s*(-503193600*s + 3241728000) - 7576934400) + 6643123200) + 1337817600) - 3952126080) + s*(s*(s*(290304000*s - 2157926400) + 8087385600) - 13536875520) + 7980094080) + s*(s*(s*(-19353600*s + 1645056000) - 7063096320) + 10578677760) - 5430136320) + s*(232243200*s - 696729600) + 503193600) - 38707200*s + 58060800) + c*(c*(c*(c*(c*(c*(c*(c*(c*(c*(c*(c*(226800*c + 3175200*s - 2948400) + s*(19051200*s - 36288000) + 12625200) + s*(s*(63504000*s - 185976000) + 127461600) - 3707760) + s*(s*(s*(127008000*s - 508032000) + 500774400) + 41845440) - 133524720) + s*(s*(s*(s*(152409600*s - 780192000) + 925344000) + 542263680) - 1263376800) + 366997680) + s*(s*(s*(s*(s*(101606400*s - 638668800) + 700358400) + 1967454720) - 4436147520) + 2285216640) + 69970320) + s*(s*(s*(s*(s*(s*(29030400*s - 217728000) - 50803200) + 2999404800) - 6769929600) + 4090443840) + 2021513760) - 1954478160) + s*(s*(s*(s*(s*(-241920000*s + 1678924800) - 3536870400) + 392716800) + 8533123200) - 10621235520) + 3069944640) + s*(s*(s*(s*(464486400*s - 3215923200) + 10204992000) - 15705043200) + 8335474560) + 1164072000) + s*(s*(s*(s*(-19353600*s + 899942400) - 3424619520) + 710277120) + 9379426560) - 8806936320) + s*(s*(s*(58060800*s - 2532096000) + 10668994560) - 16847631360) + 9472619520) + s*(s*(58060800*s - 1403136000) + 3741050880) - 2127928320) + s*(3870720*s + 1033482240) - 1552711680)
103 2020-05-19 00:13

[3/14]

         part2  = B*(A*(A*(A*c**2*(c*(c*(29030400*c + 174182400*s - 261273600) + s*(348364800*s - 1045094400) + 783820800) + s*(s*(232243200*s - 1045094400) + 1567641600) - 783820800) + c*(c*(c*(c*(c*(c*(21772800*c + 174182400*s - 203212800) + s*(522547200*s - 1248307200) + 551577600) + s*(s*(696729600*s - 2554675200) + 2090188800) + 246758400) + s*(s*(s*(348364800*s - 1741824000) + 1393459200) + 2815948800) - 3418329600) + s*(s*(-1161216000*s + 5167411200) - 8360755200) + 4833561600) + s*(-696729600*s + 2090188800) - 1567641600)) + c*(c*(c*(c*(c*(c*(c*(c*(5443200*c + 54432000*s - 52617600) + s*(217728000*s - 435456000) + 131846400) + s*(s*(435456000*s - 1349913600) + 742694400) + 256677120) + s*(s*(s*(435456000*s - 1857945600) + 1117670400) + 2228567040) - 1665740160) + s*(s*(s*(s*(174182400*s - 958003200) - 241920000) + 6178636800) - 7575724800) + 1616630400) + s*(s*(s*(-1122508800*s + 5554483200) - 8157542400) + 1485388800) + 3752179200) + s*(s*(1161216000*s - 5786726400) + 12275020800) - 9252472320) + s*(s*(-38707200*s + 2922393600) - 8387850240) + 5904783360) - 464486400*s + 696729600) + B*(A*(A*c*(c*(58060800*c + 232243200*s - 348364800) + s*(232243200*s - 696729600) + 522547200) + c*(c*(c*(c*(29030400*c + 174182400*s - 183859200) + s*(348364800*s - 774144000) + 145152000) + s*(s*(232243200*s - 812851200) - 58060800) + 1112832000) + s*(-928972800*s + 2748211200) - 2032128000)) + c*(c*(c*(c*(c*(c*(3628800*c + 29030400*s - 24192000) + s*(87091200*s - 154828800) + 4032000) + s*(s*(116121600*s - 329011200) - 67737600) + 290304000) + s*(s*(s*(58060800*s - 232243200) - 377395200) + 1354752000) - 473760000) + s*(s*(-464486400*s + 1606348800) - 774144000) - 846720000) + s*(928972800*s - 2709504000) + 1975680000)) + c*(c*(c*(c*(c*(c*(c*(c*(c*(c*(453600*c + 5443200*s - 4536000) + s*(27216000*s - 47174400) + 10735200) + s*(s*(72576000*s - 195955200) + 81043200) + 36281280) + s*(s*(s*(108864000*s - 406425600) + 197164800) + 371589120) - 204876000) + s*(s*(s*(s*(87091200*s - 420940800) + 91929600) + 1411845120) - 1371565440) + 133156800) + s*(s*(s*(s*(s*(29030400*s - 174182400) - 263692800) + 2364364800) - 2937916800) + 19595520) + 935373600) + s*(s*(s*(s*(-270950400*s + 1475712000) - 1703116800) - 2165184000) + 5123865600) - 2034002880) + s*(s*(s*(677376000*s - 3506227200) + 7190668800) - 5481745920) - 251395200) + s*(s*(s*(-19353600*s + 541900800) - 782853120) - 3935554560) + 5662406400) + s*(s*(77414400*s - 3286886400) + 8872980480) - 5715763200) + 928972800*s - 1354752000)
         part3  = c*(c*(c*(c*(c*(c*(c*(c*(c*(c*(c*(c*(c*(c*(14175*c + 226800*s - 189000) + s*(1587600*s - 2721600) + 812700) + s*(s*(6350400*s - 16783200) + 9903600) + 52080) + s*(s*(s*(15876000*s - 57456000) + 49215600) + 6347040) - 11050550) + s*(s*(s*(s*(25401600*s - 117936000) + 125193600) + 65677920) - 128034480) + 28664160) + s*(s*(s*(s*(s*(25401600*s - 145152000) + 162388800) + 281756160) - 588183120) + 233335200) + 23121812) + s*(s*(s*(s*(s*(s*(14515200*s - 99187200) + 76204800) + 609799680) - 1329558720) + 628068000) + 363318480) - 231117040) + s*(s*(s*(s*(s*(s*(s*(3628800*s - 29030400) - 37497600) + 662054400) - 1443304800) + 413965440) + 1801674000) - 1744031520) + 303711135) + s*(s*(s*(s*(s*(s*(-38707200*s + 287884800) - 517708800) - 719913600) + 3666835200) - 4386013920) + 1191840000) + 491453160) + s*(s*(s*(s*(s*(122572800*s - 891072000) + 2710512000) - 3678716160) + 179323200) + 3719604000) - 1855381864) + s*(s*(s*(s*(s*(-4838400*s + 75479040) + 11289600) - 2663646720) + 7910091840) - 7185104640) + 1227340800) + s*(s*(s*(s*(25804800*s - 972518400) + 4195215360) - 5737536000) + 766308480) + 2760323440) + s*(s*(s*(-6451200*s + 669312000) - 3513619200) + 7885409280) - 5741832320) + s*(s*(s*(1612800*s - 119347200) + 2311787520) - 5494809600) + 2494340352) + s*(s*(s*(645120*s - 5160960) + 48015360) - 2009825280) + 2832168960
         extra  = c * (part1 + part2 + part3) // 464486400
         incR   = extra + Slist [3] * countC
         incs [2] = incC
         incs [3] = incR
104 2020-05-19 00:14

[4/14]

class Group:
   def counts (self, c, Slist, counts, incs):
      pass

   def increments (self, c, Slist, counts, incs):
      pass

class LayeredGroups:
   class Group1 (Group):
      def __init__ (self, layer1):
         self.layer1 = layer1

      def counts (self, c, Slist, counts, incs):
         self.layer1.count (c, Slist, counts, incs)

      def increments (self, c, Slist, counts, incs):
         self.layer1.increment (c, Slist, counts, incs)

   class GroupN (Group):
      def __init__ (self, order, layers):
         self.order  = order
         self.layers = layers

         self.cache_coufun = [l.count for l in layers [:order]]
         self.cache_incfun = layers [order - 1].increment

      def counts (self, c, Slist, counts, incs):
         for fun in self.cache_coufun:
            fun (c, Slist, counts, incs)

      def increments (self, c, Slist, counts, incs):
         self.cache_incfun (c, Slist, counts, incs)

def work_layers_partial (c, Slist, counts, incs, nleft, countfun, order):
   order -= 1
   countfun (1, Slist, counts, incs)
   want = counts [order]
   if want > nleft:
      return 0

   low, high = 1, c
   diff      = high - low
   savec     = counts [:]
   savei     = incs   [:]

   while diff > 1:
      now  = (low + high) // 2
      countfun (now, Slist, counts, incs)
      want = counts [order]

      if want <= nleft:
         low = now
         savec [:] = counts
         savei [:] = incs
      else:
         high = now

      diff = high - low

   counts [:] = savec
   incs   [:] = savei
   return low

def work_layers_loop (n, groups):
   glen   = len (groups)
   gm1    = glen - 1
   R      = 3
   Slist  = [   4] * glen
   counts = [None] * glen
   incs   = [None] * glen
   levels = []
   s, c   = 4, 3
   done   = 2
   next   = seq2_next

   g = groups [-1]
   gcounts    = g.counts
   increments = g.increments
   slistrange = range (gm1)

   gcounts (c, Slist, counts, incs)
   advance = counts [gm1]
   done   += advance

   while done <= n:
      increments (c, Slist, counts, incs)
      R += incs [gm1]
      for k in slistrange:
         Slist [k + 1] += incs [k]
      s, c = next (levels, 0)
      Slist [0] = s
      gcounts (c, Slist, counts, incs)
      advance = counts [gm1]
      done   += advance

   done -= advance
   print ("levels:", len (levels))

   for gorder in range (glen, 1, -1):
      g = groups [gorder - 1]
      used = work_layers_partial (
         c, Slist, counts, incs,
         n - done, g.counts, gorder)

      if used > 0:
         advance = counts [gorder - 1]
         g.increments (used, Slist, counts, incs)
         R += incs [gorder - 1]
         for k in range (gorder - 1):
            Slist [k + 1] += incs [k]
         done += advance

      levels = [[s, c, used, Slist [1]]]
      s, c   = next (levels, 0)
      Slist [0] = s
      del Slist [1]

   if done < n:
      g = groups [0]
      c = n - done
      g.counts (c, Slist, counts, incs)
      g.increments (c, Slist, counts, incs)
      R += incs [0]

   return R

def work_layers (n):
   layers = [
      ChainedLayers.Layer1,
      ChainedLayers.Layer2,
      ChainedLayers.Layer3,
      ChainedLayers.Layer4,
   ]
   groups = [
      LayeredGroups.Group1 (layers [0]),
      LayeredGroups.GroupN (2, layers),
      LayeredGroups.GroupN (3, layers),
      LayeredGroups.GroupN (4, layers),
   ]
   return work_layers_loop (n, groups)
105 2020-05-19 00:15

[5/14]
I do not recommend looking at the fourth-order formula for too long, it might start looking back at you. Here are the updated timings, all in vanilla python.
- The u64 overflow R(10^10) is too small for fourth-order S-groups to pay off and the third-order timing >>76 of under 100 microseconds remains as reference.
- The u128 overflow R(10^20) is computed in under one millisecond.
- The u256 overflow R(10^39) is computed in 16 milliseconds.
- The first integer k for which R(10^k) overflows an u512 is k=78. The value of R(10^78) is computed in under 5 seconds.

$ python3 -m timeit -s 'import flake.hofs as mod' 'mod.work_layers (100000000000000000000)'
1000 loops, best of 3: 945 usec per loop
$ python3 -m timeit -s 'import flake.hofs as mod' 'mod.work_layers (1000000000000000000000000000000000000000)'
100 loops, best of 3: 15.6 msec per loop
$ python3 -m timeit -s 'import flake.hofs as mod' 'mod.work_layers (1000000000000000000000000000000000000000000000000000000000000000000000000000000)'
10 loops, best of 3: 4.79 sec per loop

R(10^78) is the appropriate value for comparing implementations with this runtime order of growth. Here is the k<=120 table in >>38 format. This is most likely the last such table I'll post in full so please excuse the length. Consider it raw research data.

106 2020-05-19 00:16

[6/14]

$ cat table4.txt
  1                                                                                                                                                                                                                                               69   7 0
  2                                                                                                                                                                                                                                             5764  13 0
  3                                                                                                                                                                                                                                           526334  20 0
  4                                                                                                                                                                                                                                         50874761  26 1
  5                                                                                                                                                                                                                                       5028514748  33 1
  6                                                                                                                                                                                                                                     500918449417  39 1
  7                                                                                                                                                                                                                                   50029364025646  46 1
  8                                                                                                                                                                                                                                 5000934571821489  53 2
  9                                                                                                                                                                                                                               500029664631299282  59 2
 10                                                                                                                                                                                                                             50000940106333921296  66 2
 11                                                                                                                                                                                                                           5000029765607020319048  73 2
 12                                                                                                                                                                                                                         500000941936492050650505  79 2
 13                                                                                                                                                                                                                       50000029798618763894670256  86 2
 14                                                                                                                                                                                                                     5000000942529842698007077786  93 2
 15                                                                                                                                                                                                                   500000029809255627825531266625  99 3
107 2020-05-19 00:18

[7/14]

 16                                                                                                                                                                                                                 50000000942720152238624116795401 106 3
 17                                                                                                                                                                                                               5000000029812655507343465281696595 112 3
 18                                                                                                                                                                                                             500000000942780823112495107784753816 119 3
 19                                                                                                                                                                                                           50000000029813737262126730811322149673 126 3
 20                                                                                                                                                                                                         5000000000942800098290022420982686040347 132 3
 21                                                                                                                                                                                                       500000000029814080548392288266955229183571 139 3
 22                                                                                                                                                                                                     50000000000942806209878293665994446398371544 146 3
 23                                                                                                                                                                                                   5000000000029814189323670710814676032031444555 152 3
 24                                                                                                                                                                                                 500000000000942808145472258657037814775197247031 159 3
 25                                                                                                                                                                                               50000000000029814223760934912839828327249688721190 166 3
 26                                                                                                                                                                                             5000000000000942808758091081952084125868709915711089 172 3
 27                                                                                                                                                                                           500000000000029814234658067055252766458087914346630413 179 3
 28                                                                                                                                                                                         50000000000000942808951913512756782469229223199209677641 186 3
 29                                                                                                                                                                                       5000000000000029814238105320163714566005337846445873165675 192 3
 30                                                                                                                                                                                     500000000000000942809013222649956573426148951590151576716407 199 4
108 2020-05-19 00:20

[8/14]

 31                                                                                                                                                                                   50000000000000029814239195666197369782628797813806672178028303 205 4
 32                                                                                                                                                                                 5000000000000000942809032613363227344483520545074111347580106666 212 4
 33                                                                                                                                                                               500000000000000029814239540504829346639521751526121067855028048469 219 4
 34                                                                                                                                                                             50000000000000000942809038745792444395013325500575549841178605176222 225 4
 35                                                                                                                                                                           5000000000000000029814239649559693010895101002840721426848127286038482 232 4
 36                                                                                                                                                                         500000000000000000942809040685134541874198687080125967207639651015633313 239 4
 37                                                                                                                                                                       50000000000000000029814239684047173947897406203055196803310606765583116781 245 4
 38                                                                                                                                                                     5000000000000000000942809041298425788194699108125613517442497904284636150437 252 4
 39                                                                                                                                                                   500000000000000000029814239694953305682145634502486118475654808671411192582303 259 4
 40                                                                                                                                                                 50000000000000000000942809041492368615124254362375085779982992292343853681977675 265 4
 41                                                                                                                                                               5000000000000000000029814239698402168816728284052931912470389462588984951289354475 272 4
 42                                                                                                                                                             500000000000000000000942809041553699275352369083555067298879759994519671549809149522 279 4
 43                                                                                                                                                           50000000000000000000029814239699492802485126708959655333290571225887358803916579127627 285 4
 44                                                                                                                                                         5000000000000000000000942809041573093831553392834637054332803551711977694994007009790372 292 4
 45                                                                                                                                                       500000000000000000000029814239699837692448235838620313436065493069882669969298165276420932 298 4
109 2020-05-19 00:21

[9/14]

 46                                                                                                                                                     50000000000000000000000942809041579226946272526629650233821592037083538450290978659280817924 305 4
 47                                                                                                                                                   5000000000000000000000029814239699946756464770327217558477196037097548855222595700238539054865 312 4
 48                                                                                                                                                 500000000000000000000000942809041581166410560146744996087637489747926009831507674531860092771246 318 4
 49                                                                                                                                               50000000000000000000000029814239699981245576707388365411525341190531682837962715909950754430162916 325 4
 50                                                                                                                                             5000000000000000000000000942809041581779723574457735429357187680244102657245323510219796435077511331 332 4
 51                                                                                                                                           500000000000000000000000029814239699992151998934816806362938022380717694881944763055115621651771537182 338 4
 52                                                                                                                                         50000000000000000000000000942809041581973670277645147248950274174680459501036705469450283128240202936345 345 4
 53                                                                                                                                       5000000000000000000000000029814239699995600913788820676216348225539327181484799269054153129487836460510789 352 4
 54                                                                                                                                     500000000000000000000000000942809041582035001627896095619939474929936571762744906288012004273501460096218956 358 4
 55                                                                                                                                   50000000000000000000000000029814239699996691556662690868009166942952903517096871912188005052332391102154504541 365 4
 56                                                                                                                                 5000000000000000000000000000942809041582054396306898966297540047317634200313888303569207665197822737010723880453 372 4
 57                                                                                                                               500000000000000000000000000029814239699997036448263909956827998702688566561312699712649393246034276487069718675623 378 4
 58                                                                                                                             50000000000000000000000000000942809041582060529443468690126506942010712319519060683290576216509510379646108458690288 385 5
 59                                                                                                                           5000000000000000000000000000029814239699997145512571896807332586675028913049270348666820028707699723929284676993408671 391 5
 60                                                                                                                         500000000000000000000000000000942809041582062468911643702033358845623678711109326514636451791089982268036336668374054905 398 5
110 2020-05-19 00:23

[10/14]

 61                                                                                                                       50000000000000000000000000000029814239699997180001735682481622436253734484378611829704069855253539840822385586766235223775 405 5
 62                                                                                                                     5000000000000000000000000000000942809041582063082225349534414976370874538365419773853994503610373186092493285764626069077930 411 5
 63                                                                                                                   500000000000000000000000000000029814239699997190908167132758797213601135850071440613709845156968123373754366585399707913755854 418 5
 64                                                                                                                 50000000000000000000000000000000942809041582063276172175725114596742736120123079153718814281207807930795334286345090895730008850 425 5
 65                                                                                                               5000000000000000000000000000000029814239699997194357083627207181322355525685599913243509599846712885018947248295200321875155512194 431 5
 66                                                                                                             500000000000000000000000000000000942809041582063337503547853702069293508176406619791980181270066919789232260704875309077658871313179 438 5
 67                                                                                                           50000000000000000000000000000000029814239699997195447726792843063653840657372075719381685614976391722679317994047727999252369922856111 445 5
 68                                                                                                         5000000000000000000000000000000000942809041582063356898230747593270774582830958194072544271344029190586861314812326101187327152707466137 451 5
 69                                                                                                       500000000000000000000000000000000029814239699997195792618445952782479879199592747532578345617801057490177491249280214020810071936484329248 458 5
 70                                                                                                     50000000000000000000000000000000000942809041582063363031368009324911993981653436695081910395214825714129009666207952735693967804641114586360 465 5
 71                                                                                                   5000000000000000000000000000000000029814239699997195901682763168111957892127609767027356231264653317643923496918836459245769003479450192260756 471 5
 72                                                                                                 500000000000000000000000000000000000942809041582063364970836307405265344147379095849591258863086231065338167605132633027300820966076112761019590 478 5
 73                                                                                               50000000000000000000000000000000000029814239699997195936171928594984731404832410431326232603415497802278529513210446399336722685688471505037581717 485 5
 74                                                                                             5000000000000000000000000000000000000942809041582063365584150035124009253385106350912037609197638702902567591834232001254415139381286688289965434265 491 5
 75                                                                                           500000000000000000000000000000000000029814239699997195947078360337128508382533807826849705743505607000402961948719068672551336010824498525861155901131 498 5
111 2020-05-19 00:25

[11/14]

 76                                                                                         50000000000000000000000000000000000000942809041582063365778096865206896625389696631480880925445600815945621310718924565484266894856253334433920035745613 504 5
 77                                                                                       5000000000000000000000000000000000000029814239699997195950527276883481022121537204551816939828037724959179119720005114619789384557978355406667770625673021 511 5
 78                                                                                     500000000000000000000000000000000000000942809041582063365839428238027648024522282176747574937498915190189902751724515553262387695706471431607983773634306949 518 5
 79                                                                                   50000000000000000000000000000000000000029814239699997195951617920058347188612863985188088019716697687439529171713502632907206540254112391538006189341119265333 524 5
 80                                                                                 5000000000000000000000000000000000000000942809041582063365858822921044628544419686861515336911850770576983501847405744828313705187013560455193479696110468330206 531 5
 81                                                                               500000000000000000000000000000000000000029814239699997195951962811713098347227573413736252403144303445747301758908535925291294897583816428354549868387341178588346 538 5
 82                                                                             50000000000000000000000000000000000000000942809041582063365864956058328249337495524348465181244040575792683558297760599704116002857011675528582962015410215017827124 544 5
 83                                                                           5000000000000000000000000000000000000000029814239699997195952071876030605575553722003515432640851210314605052934617877898005396030823635769597183022713568800739692533 551 5
 84                                                                         500000000000000000000000000000000000000000942809041582063365866895526630222251318501129855514085496196105626102656203814913215260423427828184462929343617690500791646666 558 5
 85                                                                       50000000000000000000000000000000000000000029814239699997195952106365196084356764765809535763331820943974807290580225482459630513467554281256221042352711338115017463240541 564 5
 86                                                                     5000000000000000000000000000000000000000000942809041582063365867508840358633208941979850651071615586015009119802497660371744120427648094844027760581745342810140498965106367 571 5
 87                                                                   500000000000000000000000000000000000000000029814239699997195952117271627835731401282096332807194179800666433767421322710901699216993989552590481278739190818085942770801469939 578 5
 88                                                                 50000000000000000000000000000000000000000000942809041582063365867702787188839192281512305720005862101628358486348391543656444785856690079066484000745660388932846521717583436672 584 5
 89                                                               5000000000000000000000000000000000000000000029814239699997195952120720544383725431643624010804777145056002961829350947459896502695796003933627466058904178569549311922074944075782 591 5
 90                                                             500000000000000000000000000000000000000000000942809041582063365867764118561681833720315754323670571454304241020343588011942036131390212670993069425493690411199667029506064382198016 597 5
112 2020-05-19 00:27

[12/14]

 91                                                           50000000000000000000000000000000000000000000029814239699997195952121811187558883507241345558737726545999412237587447898252547907582547510519089410040047788072242400367711147080157727 604 5
 92                                                         5000000000000000000000000000000000000000000000942809041582063365867783513244702706919210496847388097907490730561168684789641855837414230081302939593583530252590810192511687081389584649 611 5
 93                                                       500000000000000000000000000000000000000000000029814239699997195952122156079213686575662975687566014375880870268129216859868227878333405950277188139310550757934138235810778808652737796639 617 5
 94                                                     50000000000000000000000000000000000000000000000942809041582063365867789646381987019941821472362222203714728005221324275936722498476128726389007200479444393049485586814721792217509104079110 624 5
 95                                                   5000000000000000000000000000000000000000000000029814239699997195952122265143531203035031439823370678039196191802270607001412643779490569427497770692978007295457906377399559843297890568189866 631 5
 96                                                 500000000000000000000000000000000000000000000000942809041582063365867791585850289115953723515409412530453716179723949902714208291933178644568856485101792218509649629380619056180826695356377537 637 5
 97                                               50000000000000000000000000000000000000000000000029814239699997195952122299632696683457783499116765673688757669523265396670671188806266268720804525668981781967144106436746280657940665788439590390 644 5
 98                                             5000000000000000000000000000000000000000000000000942809041582063365867792199164017548801668450709192195528441356626675780278327749842187890684434038130314296479515824504606690865756223764948222340 651 5
 99                                           500000000000000000000000000000000000000000000000029814239699997195952122310539128435124332376888152625270659458987595531648669494610577903474208680016494042339796335956144164046454052238695640354016 657 5
100                                         50000000000000000000000000000000000000000000000000942809041582063365867792393110847758677724581317563632235727078699914934976135220713319517131197635890992941277256245865422676335917679671598995284082 664 5
101                                       5000000000000000000000000000000000000000000000000029814239699997195952122313988044983170272979669187564090056204087862225062294241222827751828464949986340519571497298198002598648939074996373483914447397 671 5
102                                     500000000000000000000000000000000000000000000000000942809041582063365867792454442220602011397936848113874420393537095457965215957158912649545530443213392290485913884416759482555267287764026295136483005354 677 5
103                                   50000000000000000000000000000000000000000000000000029814239699997195952122315078688158337579677655571138789770963267360003715873732916510918408098298214394658187267587530489642973331025727113006001249379524 684 5
104                                 5000000000000000000000000000000000000000000000000000942809041582063365867792473836903623007695580001287076860764743889778515149564610140577395467174937323081260061662272697625921374924102431637742255986945708 690 5
105                               500000000000000000000000000000000000000000000000000029814239699997195952122315423579813142289648032340230234978179722289107606270016375163200939959606513106143600536988097227759180425522664743968616636021441441 697 5
113 2020-05-19 00:29

[13/14]

106                             50000000000000000000000000000000000000000000000000000942809041582063365867792479970040907342608601729480939538163751892603941518401843547290072675831349350848171553750716945596883505269063591409273766136095805030 704 5
107                           5000000000000000000000000000000000000000000000000000029814239699997195952122315532644130659040929889331216248472550850083269783136807766340829778013041746760196610695120850754652637718380322298674397791085034653961 710 5
108                         500000000000000000000000000000000000000000000000000000942809041582063365867792481909509209442513232282866157701883060253714497239934368925370275988749321175503399479440603299642882935414549432956007859008157718549272 717 5
109                       50000000000000000000000000000000000000000000000000000029814239699997195952122315567133296139515592327460372291709902029314919549982973759829994860762372140116849311835050087465182281795286741721854664899827352151912566 724 5
110                     5000000000000000000000000000000000000000000000000000000942809041582063365867792482522822937876053413359268446786533037870819916002566574758232461266293922758424473117794836218022356203203733610226062472495023950284860065 730 5
111                   500000000000000000000000000000000000000000000000000000029814239699997195952122315578039727891191372323848942045187196389956266215002510615796659322779348204022642496544547177964957102389077431946880846604910511822868188331 737 5
112                 50000000000000000000000000000000000000000000000000000000942809041582063365867792482716769768086052568450245312452843417669093617146330284626106116978987640409292027276080645020792488674761112283184614545920243865425193780466 744 5
113               5000000000000000000000000000000000000000000000000000000029814239699997195952122315581488644439238954477824572294581975143652415875036756283026191242594450815983121437863375107877624835093736796129957926568426462450366758392478 750 5
114             500000000000000000000000000000000000000000000000000000000942809041582063365867792482778101140929408132244800358157207174012141617105525396954793271772415553258087888277333849857396284671289525172375713654636523221821335286376853 757 5
115           50000000000000000000000000000000000000000000000000000000029814239699997195952122315582579287614406553089530324116033795051581537701215496920388649969502926051838237707358517637569703550538467520187019116517002585257142738052253253 764 5
116         5000000000000000000000000000000000000000000000000000000000942809041582063365867792482797495823950408322620234762526209920619206513480935420807211061249643782036650334666400635855807415064897612541238001972361413653203208834167908773 770 6
117       500000000000000000000000000000000000000000000000000000000029814239699997195952122315582924179269211314970329478642833991142699924678528609685030399323964767533396715839851240530141402298048009514860572457480335347009482712253713858492 777 6
118     50000000000000000000000000000000000000000000000000000000000942809041582063365867792482803628961234743927878607006595156633637303703998869376378658739885940334308940718835321426318790230646440539042552038785423215306810427479795851308403 783 6
119   5000000000000000000000000000000000000000000000000000000000029814239699997195952122315583033243586728075483310895233493405113328031324626690805041965550114607412481285291759737215817417394308157788139557311388604511159666876568051518443324 790 6
120 500000000000000000000000000000000000000000000000000000000000942809041582063365867792482805568429536843955608187840000424522078995935973483241408413592544151956341508175361598028482106450141472450620675293371345306727392622125356063314915792 797 6
114 2020-05-19 00:30

[14/14]
Since I think R(10^100) is about as high as a reasonable person would want to go, I'll only be adding other improvements if they are interesting enough. For example, the numbers involved are well over the limit that the gmpy2 documentation states as the start of its speed advantage over python ints, so it might be time for a gmpy2 or GMP port to compare with vanilla python. So for possibly the last time, please verify the value of R(10^120) with other implementations.

157


VIP:

do not edit these