Skip to content

Instantly share code, notes, and snippets.

@volkanozcan2 volkanozcan2/collatz.js
Last active Dec 17, 2017

Embed
What would you like to do?
Collatz conjecture
function Collatz(n) {
console.log(n);
if (n == 1) {
return false;
}
if (n % 2 == 0) {
Collatz(n / 2);
} else {
Collatz(3 * n + 1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.