Created
January 5, 2021 11:54
-
-
Save darkcris1/d5017c0d1a9fe416b0770eb9c8076fdd to your computer and use it in GitHub Desktop.
Sololearn cConjecture Community Challenge
This file contains hidden or 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
function cConjecture(x) { | |
const result = [] | |
while (x > 1) { | |
if (x % 2 === 0) { | |
x = x / 2 | |
result.push(x) | |
} else { | |
x = x * 3 + 1 | |
result.push(x) | |
} | |
} | |
return result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment