阿克曼函数(Ackermann)是非原始递归函数的例子。它需要两个自然数作为输入值,输出一个自然数。它的输出值增长速度非常快,仅是对于(4,3)的输出已大得不能准确计算。
[
A(m, n)=left{egin{array}{ll}{n+1} & {m=0} \ {A(m-1,1)} & {m>0, n=0} \ {A(m-1, A(m, n-1))} & {m>0, n>0}end{array}ight.
]
因为$m$很小,所以我们可以针对$0leq m leq 3$来对阿克曼函数进行推导
对于阿克曼函数的具体推导过程如下:
当$m=0$时:
$$A(0, n)=n+1
[
– 当$m=1$时:
]
egin A(1, n) &=A(0, A(1, n-1))=A(1, n-1)+1 &=A(0, A(1, n-2))=A(1, n-2)+2 &=A(0, n-3)+3 & cdots &=A(1,0)+n &=A(0,1)+n &=n+2 end
[
– 当$m=2$时:
]
egin A(2, n) &=A(1, A(2, n-1))=A(2, n-1)+2 &=A(1, A(2, n-2))+2 &=A(2, n-2)+2 imes 2 & cdots &=A(2,0)+2 imes n &=A(1,1)+2 imes n &=3+2 imes n end
[
– 当$m=3$时:
]
egin A(3, n) &=A(2, A(3, n-1)) &=A(3, n-1) imes 2+3 &=A(2, A(3, n-2)) imes 2+3 &=(A(3, n-2) imes 2+3) imes 2+3 &=2 imes 2 imes A(3, n-2)+2 imes 3+3 &=2 imes 2 imes A(3, n-2)+2 imes 3+3 &=2 imes 2 imes(A(3, n-2)+2 imes 3+3) &=2 imes 2 imes(A(3, n-3) imes 2+3)+2 imes 3+3 &=2^ imes A(2,1)+3 imesleft(2^-1ight) &=2^ imes 5+2^ imes 3-3 &=2^{n+3}-3 end
[
]
最新评论