Theoretically can the Ackermann function be optimized?
Solution I recently wrote a bunch of solutions based on the same paper that templatetypedef mentioned. Many use generators, one for each m-value, yielding the values for n=0, n=1, n=2, etc. This one might be my favorite: def A_Stefan_generator_stack3(m, n): def a(m): if not m: yield from count(1) x = 1 for i, ai in … Read more