Skip to content

Instantly share code, notes, and snippets.

@strax
Created February 28, 2011 21:53
Show Gist options
  • Save strax/848117 to your computer and use it in GitHub Desktop.
Save strax/848117 to your computer and use it in GitHub Desktop.
var depth = 0;
function f(x, y, z) {
if(y < x) {
++depth
console.log("Recursion depth: %d", depth)
z = f(f(x - 1, y, z), f(y - 1, z, x), f(z - 1, x, y))
--depth
}
return z
}
var x = 18, y = 12, z = 6
f(x, y, z)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment