0

How can one compute the Ackermann function over nonnegative real numbers in Python per this question on Mathoverflow?

Here is my code for integers.

def naive_ackermann(m, n):
    global calls
    calls += 1
    if m == 0:
        return n + 1
    elif n == 0:
        return naive_ackermann(m - 1, 1)
    else:
        return naive_ackermann(m - 1, naive_ackermann(m, n - 1))

I tried using float and allowing it to go in between 0 and 1 but it was not continuous.

Haggis
  • 11
  • 1
  • Have you tried computing the Ackermann function over nonnegative integers? – Hong Ooi Nov 22 '20 at 12:25
  • Yes. I have. It worked. – Haggis Nov 22 '20 at 12:28
  • Gave a different one a shot in bc. Not contiguous but here it is: define ack(m, n) { if ( m < 1 && m >= 0 ) return (m+n+1); if ( n < 1 ) return (ack(m-1, 1)); return (ack(m-1, ack(m, n-1)));} – Haggis Nov 22 '20 at 12:39

0 Answers0