title: Who to talk to about non recursive Ackermann function?
body: <p>I have written a non recursive solution to the Ackermann function, it seems to work perfectly and work faster than the common recursive solution. So I am confused as to why it is a non primitive recursive function if it can be solved iteratively? Could anyone tell me if I have misunderstood something about what primitive recursive functions are or who should I talk to about this to get an answer?</p>
  
  <p>Below is the Java code:</p>
  
  <pre><code>import java.util.Scanner;
  import java.util.ArrayList;
  
  public class ackermann {
      public static void main(String[] args){
         Scanner in = new Scanner(System.in);
  
          System.out.println("Enter m:");
          int m = in.nextInt();
  
          System.out.println("Enter n:");
          int n = in.nextInt();
  
          ack(m, n);
      }
  
      public static void ack(int inM, int inN){
          if(inM &lt; 0 || inN &lt; 0) return;
  
          ArrayList&lt;ArrayList&lt;Integer&gt;&gt; arr = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;();
  
          for(int m = 0; m &lt;= inM; m++){
              arr.add(new ArrayList&lt;Integer&gt;());
          }
  
          Boolean done = false;
  
          while(done == false){
              for(int m = 0; m &lt;= inM; m++){
                  int n = arr.get(m).size();
                  int a = 0;
  
                  if(m == 0) a = n + 1;
                  else if(n == 0){
                      if(arr.get(m - 1).size() &lt;= 1) break;
                      a = arr.get(m - 1).get(1);
                  } else {
                      int k = arr.get(m).get(n - 1);
                      if(arr.get(m - 1).size() &lt;= k) break;
                      a = arr.get(m - 1).get(k);
                  }
  
                  arr.get(m).add(a);
  
                  if(m == inM &amp;&amp; n == inN){
                      System.out.println("Ack(" + inM + ", " + inN + ") = " + a);
                      done = true;
                      break;
                  }
              }
          }
      }
  }
  </code></pre>