Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f=->a,n,b=a,q=n{c,d,e=a;!c ?q:a==c ?a-1:e==0||e&&d==0?c:e ?[[c,d,f[e,n,b,q]],f[d,n,b,q],c]:n<1?9:!d ?[f[b,n-1],c]:c==0?n:[t=[f[c,n],d],n,d==0?n:[f[d,n,b,t]]]};(x=9999).times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{x.times{h=[];x.times{h=[h,h,h]};h=f[h,x*=x]until h!=0}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}};p x
- f=->a,n,b=a,q=n{ # Declare function
- c,d,e=a; # If a is an integer, c=a and d,e=nil. If a is an array, a=[c,d,e].compact, and c,d,e will become nil if there aren't enough elements in a (e.g. a=[1] #=> c=1,d=e=nil).
- !c ?q: # If c is nil, return q, else
- a==c ?a-1: # If a==c, return a-1, else
- e==0||e&&d==0?c: # If e==0 or e is not nil and d==0, return c, else
- e ?[[c,d,f[e,n,b,q]],f[d,n,b,q],c]: # If e is not nil, return an array inside an array, else
- n<1?9: # If n<1, return 9
- !d ?[f[b,n-1],c]: # If d is nil, return [f[b,n-1],c], else
- c==0?n: # If c==0, return n, else
- [t=[f[c,n],d],n,d==0?n:[f[d,n,b,t]]] # t=[f[c,n],d]. If d==0, return [t,n,n], else return [t,n,[f[d,n,b,t]]].
- }; # End of function
- (x=9999) # Declare x
- x.times{...} # Looped within 33 x.times{...} loops
- h=[]; # Declare h
- x.times{h=[h,h,h]}; # Nest h=[h,h,h] x times
- h=f[h,x*=x] # Apply x*=x, then h=f[h,x]
- until h==0 # Repeat previous line until h==0
- ;p x # print x after all of these loops
- g[0,n]=n
- g[a,n]=g[f[a,n],n+1]
- g[k,n]=n+k
- g[[0,d],n]
- = g[f[[0,d],n],n+1]
- = g[n,n+1]
- = n+n+1
- g[[[0,d],0,e],n]
- = g[f[[[0,d],0,e]],n+1]
- = g[[0,d],n+1]
- = (n+1)+(n+1)+1
- = 2n+3
- g[[[0,d],1,1],n]
- = g[f[[[0,d],1,1],n],n+1]
- = g[[[0,d],1,0],0,[0,d]],n+1]
- = g[f[[[0,d],1,0],0,[0,d]],n+1],n+2]
- = g[[[0,d],1,0],n+2]
- = g[f[[[0,d],1,0],n+2],n+3]
- = g[[0,d],n+3]
- = (n+3)+(n+3)+1
- = 2n+7
- #=> Generally g[[[0,d],1,k],n] = 2n+4k+3
- g[[[0,d],2,1],n]
- = g[f[[[0,d],2,1],n],n+1]
- = g[[[[0,d],2,0],1,[0,d]],n+1]
- = g[f[[[[0,d],2,0],1,[0,d]],n+1],n+2]
- = g[[[[[0,d],2,0],1,n+1],0,[[0,d],2,0]]],n+2]
- = g[f[[[[[0,d],2,0],1,n+1],0,[[0,d],2,0]]],n+2],n+3]
- = g[[[[0,d],2,0],1,n+1],n+3]
- = ...
- = g[[[0,d],2,0],3n+6]
- = g[f[[[0,d],2,0],2n+6],3n+7]
- = g[[0,d],3n+7]
- = (3n+7)+(3n+7)+1
- = 6n+15
- g[[[0,d],3,[0,d]],n] ≈ Ack(n,n), the Ackermann function
- g[[[0,d],3,[[0,d],0,0]],63] ≈ Graham's number
- g[[[0,d],5,[0,d]],n] ≈ G(2^^n), where 2^^n = n applications of 2^x, and G(x) is the length of the Goodstein sequence starting at x.
- g[[[0],3,[0,d]],n] ≈ tree(n), the weak tree function
- g[[[[0],3,[0,d]],2,[0,d]],n] ≈ TREE(n), the more well-known TREE function
- g[[[[0,d]],5,[0,d]],n] >≈ SCG(n), sub-cubic graph numbers
- g[[[0]],n] ≈ S(n), Chris Bird's S function
Add Comment
Please, Sign In to add comment