[Math] Collatz Conjecture Algorithm

collatz conjecturenumber theory

Related: A general question about the Collatz Conjecture and finding that integer that doesn't work

I was coding a solution to the $3k+1$ problem and was looking at ways to speed up the computation. In the related question, it is noted that the first counterexample should be an odd number, and I have adjusted my code to only search the odd numbers, immediately disregarding the evens.

Is it valid to stop computing a trajectory once the current value has dropped below the starting point?

Best Answer

I did some "independent and unpaid research" on this (much against all advice an undergrad student in mathematics receives regarding this particular problem) and arrived at the following:

The Collatz conjecture is true if and only if all positive integers of the forms $4r+3$ or $8r+3$, $r$ being odd, eventually reach lower values by iterating the Collatz function.

So indeed, you may restrict your attention to odd numbers, specifically to those of the form I just mentioned, and drop the computations when they reach lower values.

(My analysis can be pushed even further to filter away more odd numbers that will reach lower points, but I saw no clear pattern in my analysis, hence paused working on it)

A short version of my proof of the above statement: We just show that all other positive integers eventually reach lower values. For even numbers this is clear. For odd numbers, write them in the form $2^kn+1$, $n$ odd and $k>0$. Iterate the Collatz function. For even exponents $k$, 3 iterations will be enough (details left to the reader). For odd exponents other than 1, 3 iterations will again suffice. Thus the conjecture is true iff all positive integers of the form $2n+1$, $n$ odd, reach lower values.

Now, substitute $n$ by $2^xy+1$, $y$ odd and $x>1$, repeat the above analysis.

As for what happens with $4r+3$ and $8r+3$, $r$ odd…I realized that I probably wouldn't be able to finish any kind of proof with this, but that I could go on forever with these substitutions…

Also, as all others have said, please make sure that all integers less than those that you consider have already been verified, otherwise you might fool yourself (even though I feel it wouldn't matter in the long run, but it could cause some delays in finding the truth in those scenarios…).