Skip to content

Instantly share code, notes, and snippets.

@hellonico
Last active August 29, 2015 14:19
Show Gist options
  • Save hellonico/94b751cbcd124b0dc74c to your computer and use it in GitHub Desktop.
Save hellonico/94b751cbcd124b0dc74c to your computer and use it in GitHub Desktop.
public class Tak {
static long number = 0;
public static long tak(long x, long y, long z) {
if (x <= y)
return y;
else
number ++;
return
tak(tak(x-1, y, z),tak(y-1, z, x),tak(z-1, x, y));
}
public static long takeuchi_number(int n) {
number = 0;
tak(n,0,n+1);
return number;
}
public static void main(String[] args) {
System.out.println(takeuchi_number(10));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment