For the sequence
\begin{align}
a_0&\in\mathbb{N}+1=\{1,2,3,\dots\}\\
a_{k+1}&= \left\{
\begin{array}{rl}
a_k \div 2 & \quad2\mid a_k \\
3a_k+1 & \quad2\nmid a_k
\end{array}
\right.
\end{align}
the Collatz conjecture states that
\begin{equation}
\forall\,a_0\,\exists\,k\text{ such that } a_k=1
\end{equation}
In base 2, the process can be rephrased as repeatedly
- Removing trailing 0s (removes factors of 2 until odd)
- Appending 1 to the end of the number (\(=2a_k+1\))
- Adding the result to the previous number (\(=3a_k+1\))
111 7 1111 1011The process can be rephrased in base 3 with a 1 (carry) bit left-to-right state-machine.011 10111 10001017 100011 11010013 11011 1010005 1011 100001
- Initially, the carry bit is off, so \(0\to0\) and \(2\to1\)
- With the carry bit off, \(1\to0\), flipping the carry bit on
- With the carry bit on, \(1\to2\), flipping the carry bit off
- With the carry bit on, \(0\to1\) and \(2\to2\)
- If the number ends with the carry bit on, append 2
Using = 3
21 7 102 11 0122 17 0222 26 111 13 0202 20 101 10 012 5 022 8 11 4 02 2 1 1