Skip to main content
YJD𝕏

The Impossible Conjecture

The Collatz Conjecture is an unsolved problem in mathematics. This conjecture is named after the mathematician Lothar Collatz, who introduced the idea in 1937. The conjecture also known as Syrucuse conjecture or problem.

Take any positive integer n. If n is even then divide it by 2, else do "triple plus one" and get 3n+1. The conjecture is that for all numbers, this process converges to one.

Paul ErdΕ‘s said about the Collatz conjecture, "Mathematics may not be ready for such problems."

Jeffrey Lagarias stated that the Collatz conjecture "is an extraordinarily difficult problem, completely out of reach of present day mathematics."

Implementation Of The Collatz Conjecture in Python #

The constant MAX_ITERATIONS controls the maximum number of times, the sequence 4, 2, 1 is repeated while the variable count stores the number of occurences of the number 1

If the number is even, it is divided by 2, its divisibility by 2 is proven by numeral%2, which in this case, should be equal to zero.

If the number is odd, it is multiplied by 3 and '1' is added to the product, its divisibility by 2 in this case numeral%2, should not be equal to zero and should provide the remainder of the number on division by 2

Output of the Python Code #

For the following example, the number 10 has been used

Enter a numeral: 10
Enter the number of iterations of the sequence: 3
/2: 5
3x+1: 16
/2: 8
/2: 4
/2: 2
/2: 1
3x+1: 4
/2: 2
/2: 1
3x+1: 4
/2: 2
/2: 1
3x+1: 4
/2: 2
/2: 1
The sequence `4, 2, 1` has been repeated  3 times!