kxcoze

fun_Ackerman

Feb 1st, 2020
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. def Ak(m,n):
  2.       if m == 0 and n > 0:
  3.           return n + 1
  4.       if m > 0 and n == 0:
  5.           return Ak(m - 1, 1)
  6.       if m > 0 and n > 0:
  7.           return Ak(m - 1, Ak(m, n - 1))
  8.  
  9.   m, n = (int(x) for x in input('Введите m и n cоотвественно для вычисления функции Аккермана:
  10.   ').split())
  11.  
  12. >>print('Ak(', m, ',', n, ')', ' = ', Ak(m,n), sep = '')
Advertisement
Add Comment
Please, Sign In to add comment