Googology Wiki
Googology Wiki

I don't speak Engliish

Loader's number on PascalABC.NET (Delphi):

Code

var
a, r: int64;


function P(x, y: int64): int64;
begin
P := (x - not x) shl y;
end;

function Z(x: int64): int64;
begin
if (x mod 2 <> 0) then
begin
  Z := 0;
  r := 0;
end
else
begin
  r := 1 + Z(x div 2);
  Z := r;
end;
end;

function L(x: int64): int64;
begin
L := (x div 2) shr Z(x);
end;

function S(v, y, c, t: int64): int64;
var
f := L(t);
x := r;
B: int64;
begin
if (L(S(v, y, c, L(x))) = 1) then
  B := S(4, S(v, y, c, Z(x)), 4, Z(r))
else
  B := 5 shl P(S(v, y, c, L(x)), S(v, y, c, Z(x)));
if (f = 2) then
  S := B   
else
if (f > 2) then
  if (f = v) then
    S := y
  else
  if (f > v) then
    S := t - c
  else
    S := t
else
begin
  t := S(4, 13, -4, y);
  S := P(f, P(S(v, y, c, L(x)), S(v + 2, t, c, Z(x))));
end;
end;

function M(x, y: int64): int64;
begin
if (L(x) = 1) then
  M := S(4, y, 4, Z(r))
else
  M := 5 shl P(x, y);
end;

function D(x: int64): int64;
var
f, b: int64;
c := 0;
t := 7;
u := 14;
begin
if (x <> 0) then
  D := D(x - 1);
x := x div 2;
while (x mod 2 = 1) do
begin
  b := L(L(D(x)));
  f := L(r);
  x := L(r);
  if (c = r) then
  begin
    if (L(u) = 0) and (L(u) - f = 0) then
    begin
      x := x div 2;
      if (x mod 2 <> 0) then
      begin
        u := S(4, b, 4, r);
        t := M(t, b);
      end;
    end;
    x := x div 2;
    if (((f mod 2) and (x mod 2)) <> 0) then
    begin
      c := P(b, c);
      t := S(4, 13, -4, t);
      u := S(4, 13, -4, u);
    end;
  end;
  if (c <> 0) then
  begin
    x := x div 2;
    if (x mod 2 <> 0) then
    begin
      x := x div 2;
      if (((not u) and 2) or (x mod 2) <> 0) then
      begin
        u := 1 shl P(L(c), u);
        t := P(1, P(L(c), t));
      end
      else
        t := P(0, P(L(c), t));
      c := r;
    end;
  end;
  x := x div 2;
  if ((u div 2) or (x mod 2) <> 0) then
  begin
    c := P(t, c);
    u := S(4, 13, -4, t);
    t := 9;  
  end;
  //if (x <> 0) then
  //D := D(x - 1);
end;
a := P(P(t, P(u, P(x, c))), a);
D := a;
end;

begin
writeln(D(D(D(D(D(99))))));
end.