13
\$\begingroup\$

As a follow up to Shortest terminating program whose output size exceeds Graham's number and Golf a number bigger than TREE(3), I present a new challenge.

Loader's number is a very large number, that is kind of hard to explain (since it was itself the result of a code golfing exercise with a flexible goal). There is a definition and explanation here, but for the purposes of self-containment, I will attempt to explain it later in this post as well.

The algorithm Ralph Loader used produces one of the largest numbers of any (computable) algorithm ever written! Indeed, Loader's number is the largest "computable" number on the Googology Wiki. (By "computable" number, they mean a number defined in terms of a computation.) That means that if answer produces a number larger than Loader's number in an interesting way (i.e. not just Loader's number+1), you could go down in Googology history! That being said, programs that produce something like Loader's number+1 are definitely valid answers and contenders to this question; just don't expect any fame.

Your job is to create a terminating program that produces a number larger than Loader's number. This is , so the shortest program wins!

  • You aren't allowed to take input.
  • Your program must eventually terminate deterministically but you can assume the machine has infinite memory.
  • You may assume your language's number type can hold any finite value but need to explain how this exactly works in your language (ex: does a float have infinite precision?)
    • Infinities are not allowed as output.
    • Underflow of a number type throws an exception. It does not wrap around.
  • You need to provide an explanation of why your number is so big and an ungolfed version of your code to check if your solution is valid (since there is no computer with enough memory to store Loader's number).

So here is an explanation of Loader's number. See http://googology.wikia.com/wiki/Loader%27s_number and the links therein for more precise details. In particular, it contains a program that produces Loader's number exactly (by definition).

The calculus of constructions is essentially a programming language with very particular properties.

First of all, every syntactically valid program terminates. There are no infinite loops. This will be very useful, because it means that if we run an arbitrary calculus of constructions program, our program will not get stuck. The problem is that this implies the calculus of constructions is not Turing complete.

Second of all, among non-Turing complete languages, it is one of the most powerful. Essentially, if you can prove that a Turing machine will halt on every input, you can program a function in the calculus of constructions that will simulate it. (This does not make it turing complete, because there are halting turing machines that you can not prove are halting.)

Loader's number is essentially a busy beaver number for the calculus of constructions, which is possible to compute since all coc programs terminate.

In particular, loader.c defines a function called D. Approximately, D(x) iterates over all bit-strings less than x, interprets them as a coc programs, runs the syntactically valid ones, and concatenates the results (which will also be bitstrings). It returns this concatenation.

Loader's number is D(D(D(D(D(99))))).

A more readable copy of the code from the googolology wiki

int r, a;

P(y,x){return y- ~y<<x;}

Z(x){return r = x % 2 ? 0 : 1 + Z (x / 2 );}

L(x){return x/2 >> Z(x);}

S(v,y,c,t){
   int f = L(t);         
   int x = r;
   return f-2 ? f>2 ? f-v ? t-(f>v)*c : y : P(f,P(S(v,y,c,L(x)), S(v+2,t=S(4,13,-4,y),c,Z(x)))) : A(S(v,y,c,L(x)),S(v,y,c,Z(x)));
}

A(y,x){return L(y)-1 ? 5<<P(y,x) : S(4,x,4,Z(r));}

D(x) 
{
   int f;
   int d;
   int c=0;
   int t=7;
   int u=14;
   while(x&&D(x-1),(x/=2)%2&&(1)){
      d = L(L(D(x))),
      f = L(r),
      x = L(r),
      c - r||(L(u)||L(r)-f||(x/=2)%2&&(u=S(4,d,4, r),t=A(t,d)),f/2&(x/=2)%2&&(c=P(d,c),t=S(4,13,-4,t),u=S(4,13,-4,u))),
      c&&(x/=2)%2&&(t=P(~u&2|(x/=2)%2&&(u=1<<P(L(c),u)),P(L(c),t)),c=r)
      u/2&(x/=2)%2&&(c=P(t,c),u=S(4,13,-4,t),t=9);
    }
    return a = P( P( t, P( u, P( x, c)) ),a);
}

main(){return D(D(D(D(D(99)))));}
\$\endgroup\$
  • \$\begingroup\$ You know Googology Wiki? I'm MilkyWay90 there! \$\endgroup\$ – MilkyWay90 Dec 3 '18 at 23:39
  • \$\begingroup\$ @MilkyWay90 oh, cool. \$\endgroup\$ – PyRulez Dec 3 '18 at 23:57
  • 5
    \$\begingroup\$ I would advise against downvoting this for similarity to the TREE(3) question: Loader's number is so much larger than TREE(3) that new and interesting approaches are required. \$\endgroup\$ – lirtosiast Dec 4 '18 at 1:00
  • \$\begingroup\$ @Spitemaster Why do you say that? Since this is code-golf, you need to beat the other answers to be competitive. So if someone else posts a 512 byte answer, you have to beat 512 bytes to win. It's not just whoever posts an answer first. (Also, for the sake of pendantory, the original program is not valid, since answers need to produce a number larger than Loader's number.) \$\endgroup\$ – PyRulez Dec 4 '18 at 1:16
  • 1
    \$\begingroup\$ @fəˈnɛtɪk Well, printing Loader's number + 1 is still interesting from a code golf perspective (for example, can you beat the original 512 bytes?) There are also some natural generalizations of loader's number that might be easier to implement (for example, using ZFC instead of CoC). Also, Greedy clique sequences or finite promise games could be used. \$\endgroup\$ – PyRulez Dec 4 '18 at 3:24
0
\$\begingroup\$

JavaScript, D^6(9)(Untested) (508501B)

_='r=a=0;PIy-~y<<x;ZJr=x%2?0:1+Rx/2);LJx/2>>RG;S=Ct)=>{OEtBx=rHf-2?f>2?f-v?t-(f>v)*c:y:Ff,FQ(v+2,t@yBc,RGK):A(QCRGK};AIEy)-1?5<<Fy,G:S(4,x,4,RrK;DJ{for(Od=c=0,t=7,u=14;Mx-1B!((x/=2)%2);)d=EEMG)Bf=ErBx=ErBc-r||(Eu)||Er)-f||8u=S(4,d,4,rBt=A(t,d)BfNd,cBt@tBu@uKBc&&8t=F~u&2|8u=1<<FEcBu)BFEcBt)Bc=rBuNt,cBu@tBt=9)Ha=FFt,Fu,Fx,cKBa)};MMMMMM9KKK8(x/=2)%2&&(@=S(4,13,-4,B),C(v,y,c,EL(N/2&8c=FFP(I=(y,G=>QSCEGBSGx)H;return J=x=>K))MD(Ovar f=RZ(';for(Y in $='ROMKJHGQIFNECB@8')with(_.split($[Y]))_=join(pop());eval(_)

This is an encoded code.

_='r=a=0;PIy-~y<<x;ZJr=x%2?0:1+Rx/2);LJx/2>>RG;S=Ct)=>{OEtBx=rHf-2?f>2?f-v?t-(f>v)*c:y:Ff,FQ(v+2,t@yBc,RGK):A(QCRGK};AIEy)-1?5<<Fy,G:S(4,x,4,RrK;DJ{for(Od=c=0,t=7,u=14;Mx-1B!((x/=2)%2);)d=EEMG)Bf=ErBx=ErBc-r||(Eu)||Er)-f||8u=S(4,d,4,rBt=A(t,d)BfNd,cBt@tBu@uKBc&&8t=F~u&2|8u=1<<FEcBu)BFEcBt)Bc=rBuNt,cBu@tBt=9)Ha=FFt,Fu,Fx,cKBa)};MMMMMM9KKK8(x/=2)%2&&(@=S(4,13,-4,B),C(v,y,c,EL(N/2&8c=FFP(I=(y,G=>QSCEGBSGx)H;return J=x=>K))MD(Ovar f=RZ('; //encoded code
for(Y in $='ROMKJHGQIFNECB@8')with(_.split($[Y]))_=join(pop()); //decoding algorithm
eval(_) //Evaluation of the string

Decoded code:

r=a=0;P=(y,x)=>y-~y<<x;Z=x=>r=x%2?0:1+Z(x/2);L=x=>x/2>>Z(x);S=(v,y,c,t)=>{var f=L(t),x=r;return f-2?f>2?f-v?t-(f>v)*c:y:P(f,P(S(v,y,c,L(x)),S(v+2,t=S(4,13,-4,y),c,Z(x)))):A(S(v,y,c,L(x)),S(v,y,c,Z(x)))};A=(y,x)=>L(y)-1?5<<P(y,x):S(4,x,4,Z(r));D=x=>{for(var f=d=c=0,t=7,u=14;D(x-1),!((x/=2)%2&&(1));)d=L(L(D(x))),f=L(r),x=L(r),c-r||(L(u)||L(r)-f||(x/=2)%2&&(u=S(4,d,4,r),t=A(t,d)),f/2&(x/=2)%2&&(c=P(d,c),t=S(4,13,-4,t),u=S(4,13,-4,u))),c&&(x/=2)%2&&(t=P(~u&2|(x/=2)%2&&(u=1<<P(L(c),u)),P(L(c),t)),c=r),u/2&(x/=2)%2&&(c=P(t,c),u=S(4,13,-4,t),t=9);return a=P(P(t,P(u,P(x,c))),a)};D(D(D(D(D(D(9))))))

Decoded, ungolfed code(conditions and stuff are kept from loader.c):

var r=a=0;
function P(y,x){
  return y-~y<<x;
}
function Z(x){
  return r=x%2?0:1+Z(x/2);
}
function L(x){
  return x/2>>Z(x);
}
function S(v,y,c,t){
  var f=L(t),x=r;
  return f-2?
           f>2?
             f-v?
               t-(f>v)*c
               :y
             :P(f,P(S(v,y,c,L(x)),S(v+2,t=S(4,13,-4,y),c,Z(x))))
           :A(S(v,y,c,L(x)),S(v,y,c,Z(x)))
}
function A(y,x){
  return L(y)-1?
         5<<P(y,x):
         S(4,x,4,Z(r));
}
function D(x){
  var f=
      d=
      c=0,
      t=7,
      u=14;
  for(;D(x-1),!((x/=2)%2&&(1));) //uses for loop since JavaScript(from what I know) doesn't support multiple statements in while loop, and it also is same length.
    d=L(L(D(x))),
    f=L(r),
    x=L(r),
    c-r||(
      L(u)||L(r)-f||
      (x/=2)%2&&(
        u=S(4,d,4,r),t=A(t,d)
      ),
      f/2&(x/=2)%2&&(
        c=P(d,c),
        t=S(4,13,-4,t),
        u=S(4,13,-4,u)
      )
    ),
    c&&(x/=2)%2&&(
      t=P(
        ~u&2|(x/=2)%2&&(
          u=1<<P(L(c),u)
        ),
        P(L(c),t)
      ),
      c=r
    ),
    u/2&(x/=2)%2&&(
      c=P(t,c),
      u=S(4,13,-4,t),
      t=9
    );
  return a=P(P(t,P(u,P(x,c))),a)
};
D(D(D(D(D(D(9))))))

This is actually(modified) one of attempts of similar stuff, and right now ~460 byte is listed, however I discovered that the code is malformed... And this one was one that I was able to run without syntax error, so that's cool.

Encoding/Decoding algorithm:

The encoding is done as follows:

  • Take a repeated string, call it S.
  • Replace all S in the code to a key K.
  • Put K and S at the end.
  • Make a list of keys, and also put decoding algorithm so the code actually runs.

The decoding algorithm:

  • Take list of keys.
  • Take the earliest key K.
  • Split the string for each K.
  • Since last of the array is what to replace K S, pop it, and replace all K by joining the array with the popped value S.

The compression was done with this code, check only the last box. Since this will encode the largest save first, it is not the most efficient compression, but I don't know how to make it smaller either so meh.

  • 508B->501B, -7B
    • -1B for... I don't know why. I did change D(D(D(D(D(99))))) to D(D(D(D(D(D(9)))))). Also that shuffled the letters.
    • -6B for re-adding &&(1) for D(x)'s loop condition.
\$\endgroup\$
  • \$\begingroup\$ Note, it should be a number larger than Loader's number, not equal to it, though a simple fix would be to just add one. \$\endgroup\$ – Jo King Apr 26 at 5:35
  • \$\begingroup\$ Or easily pass it with equal length by replaceing 99 with M9, which makes the value D^6(9). \$\endgroup\$ – Naruyoko Apr 26 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.