Skip to content

Instantly share code, notes, and snippets.

@andreuinyu
Last active January 18, 2016 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreuinyu/0c92b5a3deb0d3e96df2 to your computer and use it in GitHub Desktop.
Save andreuinyu/0c92b5a3deb0d3e96df2 to your computer and use it in GitHub Desktop.
Ackerman
#include <iostream>
using namespace std;
int ackerman(int a, int b){
if (a==0) return b+1;
else if (b==0) return ackerman(a-1, 1);
else return ackerman(a-1, ackerman(a, b-1));
}
int main(){
cout << ackerman(2, 200) << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment