Googology Wiki
Advertisement
Googology Wiki

This is something I've been passively working on since October I think. After my results from arithmetising worms, I looked at Ackermann and said "you're next." My goal was to derive a single-argument function that could fully simulate \(Ack(a,b)\) (using Robinson's definition). The biggest snag of course was finding a sufficiently nice-looking method of pairing and unpairing tuples of natural numbers. Well, I've finally found something I'm satisfied with! I call this disgusting creature the "Wackermann function" for reasons which will hopefully become obvious. It only uses the four standard operators (+,-,×,÷) along with square roots and rounding down (the floor function). 

The method

Here's the main idea behind how I combined the Ackermann function's two inputs into just one. Each pair of natural numbers is a unique lattice point in the first quadrant of the plane. Draw a series of line segments going diagonally up and to the left, through all the lattice points, and label each point in the order it was crossed, starting from 0. Done! The corresponding formulas for the points and their assigned ordinals were much simpler and more computer-friendly than for the other methods I tried.

\[ \text{Pair}(a,b)=\frac{(a+b)(a+b+1)}2+b\\ \text{GetA}(n)=\frac{\lambda(\lambda+3)}2-n\\ \text{GetB}(n)=n-\frac{\lambda(\lambda+1)}2 \]

In both of these "unpairing" functions, \(\lambda=\left\lfloor\frac{-1+\sqrt{1+8n}}2\right\rfloor\) calculates which line contains the point with the assigned value n.

Bijection diagram

Notice that the bottom points are assigned the triangular numbers. Nice.














The formula

Now all I had to do was translate the rules of the Ackermann function. I'm very surprised with how simplistic the first two rules ended up. I can't say the same for the last rule, but that's partially why I call this the Wackermann function.

\[ \text{Wack}(n)=\begin{cases} \text{if }\frac{-3+\sqrt{9+8n}}2=\left\lfloor\frac{-3+\sqrt{9+8n}}2\right\rfloor:& \frac{-1+\sqrt{9+8n}}2\\ \text{else if }\frac{-1+\sqrt{1+8n}}2=\left\lfloor\frac{-1+\sqrt{1+8n}}2\right\rfloor:& \text{Wack}(n+1)\\ \text{otherwise}:& \text{Wack}\!\left(\frac{\left(\left\lfloor\frac{-1+\sqrt{1+8n}}2\right\rfloor\times\left\lfloor\frac{5+\sqrt{1+8n}}2\right\rfloor-2n+2\text{Wack}\left(n-\left\lfloor\frac{1+\sqrt{1+8n}}2\right\rfloor\right)-2\right) \left(\left\lfloor\frac{-1+\sqrt{1+8n}}2\right\rfloor\times\left\lfloor\frac{5+\sqrt{1+8n}}2\right\rfloor-2n+2\text{Wack}\left(n-\left\lfloor\frac{1+\sqrt{1+8n}}2\right\rfloor\right)\right)}8+ \text{Wack}\left(n-\left\lfloor\frac{1+\sqrt{1+8n}}2\right\rfloor\right)\right) \end{cases} \]

Now that's what I call a mess! Still, I'm oddly satisfied how its definition contains such basic operations. Here is a graph of the first few outputs (the points are colored according to the corresponding values of a for \(Ack(a,b)\)):

Wackermann plot

The colors for a=0,1,2,3, & 4 are green, orange, red, blue, and purple, respectively.


















The program

I leave you with the Python program for the Wackermann function. Try it out on a couple small inputs! Anyway, if you've read this far, thank you so much for listening to my trifles. :)

def Wack(n):
  if ((-3+(9+8*n)**.5)/2)%1==0:
    return int((-1+(9+8*n)**.5)/2)
  elif ((-1+(1+8*n)**.5)/2)%1==0:
    return Wack(n+1)
  else:
    return Wack(((int((-1+(1+8*n)**.5)/2)*int((5+(1+8*n)**.5)/2)-2*n-2+2*Wack(n-int((1+(1+8*n)**.5)/2)))*(int((-1+(1+8*n)**.5)/2)*int((5+(1+8*n)**.5)/2)-2*n+2*Wack(n-int((1+(1+8*n)**.5)/2))))//8+Wack(n-int((1+(1+8*n)**.5)/2)))
Advertisement