Skip to content

Instantly share code, notes, and snippets.

@relrod
Created December 7, 2009 17:16
Show Gist options
  • Save relrod/250942 to your computer and use it in GitHub Desktop.
Save relrod/250942 to your computer and use it in GitHub Desktop.
// Fufills ( http://rosettacode.org/wiki/Ackermann_Function ) in Pike.
int main(){
write(ackermann(3,4) + "\n");
}
int ackermann(int m, int n){
if(m == 0){
return n + 1;
} else if(n == 0){
return ackermann(m-1, 1);
} else {
return ackermann(m-1, ackermann(m, n-1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment