Question: Ackermann code - I need your help for Maple 15

Hi, I've been introudeced to maple today and we were asked to think about how we'd write a two argument Ackermann code. I appreciate that computing power can lead to problems when workin gout this kind of recursive problem. I've done a bit of reading around but no joy on the maple front to be honest.

 

I thought the code may look like something like this but it's not right. Any thelp would be greatly appreciated!

# Ackermann-Peter function

Ackermann:=proc(m::nonnegint,n::nonnegint)::nonnegint
local
 
if m=0 then n+1
elif n=0 then Ackermann(m-1,1)
else Ackermann(Ackermann(m-1,Ackermann(m,n-1))
end if
end proc;

 

Thanks.

Please Wait...