Guest User

Untitled

a guest
Nov 24th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.86 KB | None | 0 0
  1. 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
  2.  
  3. f=->a,n,b=a,q=n{ # Declare function
  4. 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).
  5. !c ?q: # If c is nil, return q, else
  6. a==c ?a-1: # If a==c, return a-1, else
  7. e==0||e&&d==0?c: # If e==0 or e is not nil and d==0, return c, else
  8. 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
  9. n<1?9: # If n<1, return 9
  10. !d ?[f[b,n-1],c]: # If d is nil, return [f[b,n-1],c], else
  11. c==0?n: # If c==0, return n, else
  12. [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]]].
  13. }; # End of function
  14. (x=9999) # Declare x
  15. x.times{...} # Looped within 33 x.times{...} loops
  16. h=[]; # Declare h
  17. x.times{h=[h,h,h]}; # Nest h=[h,h,h] x times
  18. h=f[h,x*=x] # Apply x*=x, then h=f[h,x]
  19. until h==0 # Repeat previous line until h==0
  20. ;p x # print x after all of these loops
  21.  
  22. g[0,n]=n
  23. g[a,n]=g[f[a,n],n+1]
  24.  
  25. g[k,n]=n+k
  26.  
  27. g[[0,d],n]
  28. = g[f[[0,d],n],n+1]
  29. = g[n,n+1]
  30. = n+n+1
  31.  
  32. g[[[0,d],0,e],n]
  33. = g[f[[[0,d],0,e]],n+1]
  34. = g[[0,d],n+1]
  35. = (n+1)+(n+1)+1
  36. = 2n+3
  37.  
  38. g[[[0,d],1,1],n]
  39. = g[f[[[0,d],1,1],n],n+1]
  40. = g[[[0,d],1,0],0,[0,d]],n+1]
  41. = g[f[[[0,d],1,0],0,[0,d]],n+1],n+2]
  42. = g[[[0,d],1,0],n+2]
  43. = g[f[[[0,d],1,0],n+2],n+3]
  44. = g[[0,d],n+3]
  45. = (n+3)+(n+3)+1
  46. = 2n+7
  47.  
  48. #=> Generally g[[[0,d],1,k],n] = 2n+4k+3
  49.  
  50. g[[[0,d],2,1],n]
  51. = g[f[[[0,d],2,1],n],n+1]
  52. = g[[[[0,d],2,0],1,[0,d]],n+1]
  53. = g[f[[[[0,d],2,0],1,[0,d]],n+1],n+2]
  54. = g[[[[[0,d],2,0],1,n+1],0,[[0,d],2,0]]],n+2]
  55. = g[f[[[[[0,d],2,0],1,n+1],0,[[0,d],2,0]]],n+2],n+3]
  56. = g[[[[0,d],2,0],1,n+1],n+3]
  57. = ...
  58. = g[[[0,d],2,0],3n+6]
  59. = g[f[[[0,d],2,0],2n+6],3n+7]
  60. = g[[0,d],3n+7]
  61. = (3n+7)+(3n+7)+1
  62. = 6n+15
  63.  
  64. g[[[0,d],3,[0,d]],n] ≈ Ack(n,n), the Ackermann function
  65. g[[[0,d],3,[[0,d],0,0]],63] ≈ Graham's number
  66. 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.
  67.  
  68. g[[[0],3,[0,d]],n] ≈ tree(n), the weak tree function
  69. g[[[[0],3,[0,d]],2,[0,d]],n] ≈ TREE(n), the more well-known TREE function
  70. g[[[[0,d]],5,[0,d]],n] >≈ SCG(n), sub-cubic graph numbers
  71. g[[[0]],n] ≈ S(n), Chris Bird's S function
Add Comment
Please, Sign In to add comment