Skip to content

Instantly share code, notes, and snippets.

@betacar
Last active August 29, 2015 14:21
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 betacar/7ea94dca5104a3511516 to your computer and use it in GitHub Desktop.
Save betacar/7ea94dca5104a3511516 to your computer and use it in GitHub Desktop.
Famous math problems
var collatz = function(n) {
var result;
console.log(n);
result = n % 2 == 0 ? n/2 : 3 * (n + 1);
return collatz(result);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment