Skip to content

Instantly share code, notes, and snippets.

@xto3na
Last active August 8, 2021 13:08
Show Gist options
  • Save xto3na/0388f992f3a9a58d6812d0827817e6c1 to your computer and use it in GitHub Desktop.
Save xto3na/0388f992f3a9a58d6812d0827817e6c1 to your computer and use it in GitHub Desktop.
function threePlusOne(number) {
console.info(number);
if(number === 1 || number === 0) {
return number;
} else {
if(number%2) {
threePlusOne(number * 3 + 1);
} else {
threePlusOne(number / 2);
}
}
}
@xto3na
Copy link
Author

xto3na commented Aug 8, 2021

The Collatz Conjecture is the simplest math problem no one can solve — it is easy enough for almost anyone to understand but notoriously difficult to solve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment