Basic code for the Collatz Connjecture to calculate numbers in the sequence.
-
The Collatz Algorithm states that you can take a random number x:
-
If x is an odd number, you use the formula 3x+1 or you multiply it by 3 and add one.
-
Else, if it's an even number, you divide the number by 2.
-
No matter what number you start with, you'll end up with the combination 4 -> 2 -> 1, which loop back to eachother.
-
The unsolved connjecture is named after it's founder, Lothar Collatz.