Last active
August 29, 2015 14:21
-
-
Save betacar/7ea94dca5104a3511516 to your computer and use it in GitHub Desktop.
Famous math problems
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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