Testing Collatz Conjecture

Collatz conjecture states that take any natural number \(n\) , if \(n\) is even divide it by \(2\) to get \(n/2\) , if \(n\) is odd multiply it by \(3\) and add \(1\) to get \(3n+1\) . Repeat the process indefinitely, no matter what number you start with, you will always eventually reach \(1\)

Proving or disproving this conjecture is still a open problem in mathematics, but anyways here's the problem :

From first \(100\) natural numbers, find the number which takes most number of iterations to reach \(1\)(Remember we have to stop as soon as we reach to \(1\) otherwise we will end in an indefinte cycle of \(4-2-1\))

As an example for number \(6\) we have :

\(6\rightarrow 3\rightarrow 10\rightarrow 5\rightarrow 16\rightarrow 8\rightarrow 4\rightarrow 2\rightarrow 1 \)

Here it is clear that \(8\) iterations are involved


Problem Loading...

Note Loading...

Set Loading...