Created
December 6, 2017 14:58
-
-
Save eaglgenes101/336948f2155d84b14ea740d1f0ccce84 to your computer and use it in GitHub Desktop.
Readable implementation of Loader's number in Julia
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r = 0; | |
a = 0; | |
/ = div; | |
P(y, x) = y - ~y << x; | |
function Z(x) | |
if x%2 == 0 | |
global r = 1 + Z(x/2); | |
else | |
global r = 0; | |
end | |
return r; | |
end | |
L(x) = x/2 >> Z(x); | |
function S(v, y, c, t) | |
f = L(t); | |
x = r; | |
if f > 2 | |
if f > v | |
return t - c; | |
elseif f < v | |
return t; | |
else | |
return y; | |
end | |
elseif f < 2 | |
return P(f, P(S(v, y, c, L(X)), S(v+2, t = S(4, 13, -4, y), c, Z(x)))); | |
else | |
return A(S(v, y, c, L(x)), S(v, y, c, Z(x))); | |
end | |
end | |
function A(y, x) | |
if L(y) != 1 | |
return 5 << P(y, x); | |
else | |
return S(4, x, 4, Z(r)); | |
end | |
end | |
function D(x) | |
f = 0; | |
d = 0; | |
c = 0; | |
t = 7; | |
u = 14; | |
while true | |
if x != 0 | |
D(x-1); | |
end | |
if (x /= 2) % 2 == 0 | |
break; | |
end | |
d = L(L(D(x))); | |
f = L(r); | |
x = L(r); | |
if c == r | |
if L(u) != 0 || L(r) != f || (x /= 2) % 2 != 0 | |
u = S(4, d, 4, r); | |
t = A(t, d); | |
end | |
if f/2 & ((x /= 2) % 2) != 0 | |
c = P(d, c); | |
t = S(4, 13, -4, t); | |
u = S(4, 14, -4, u); | |
end | |
end | |
if c != 0 && (x /= 2) % 2 != 0 | |
if ~u & 2 | ((x /= 2) % 2) != 0 | |
u = 1 << P(L(c), u); | |
end | |
t = P(L(c), t); | |
c = r; | |
end | |
if u/2 & ((x /= 2) % 2) != 0 | |
c = P(t, c); | |
u = S(4, 13, -4, t); | |
t = 9; | |
end | |
end | |
global a = P(P(t, P(u, P(x, c))), a); | |
return a; | |
end | |
D(D(D(D(D(BigInt(99)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment