The Collatz Conjecture asks if, for all \(n > 0\) the sequence defined by $$a_i =\begin{cases}n & i = 0 \\ f(a_{i-1}) & i > 0\end{cases}$$ where $$f(x) := \begin{cases} x/2 & x\text{ is even.} \\ 3x + 1 & x\text{ is odd.}\end{cases},$$ does \(a_i\) eventually reach \(1\)? In this weakening of the conjecture we will be interested in numbers that take a long time to reach \(1\).
Please submit a CSV file that contains a single number.
So far, we know no such \(n\) where the sequence above does not terminate at \(1\). For this submission, we will investigate numbers that take a comparitively long time to reach \(1\) relative to their magnitude. Let \(b(n)\) be the length of \(n\) as a binary number and let \(\mathsf{Orbit}(n)\) be the number of times the sequence above increases (do not count the number of times the sequence decreases). Then your goal is to obtain a high score where the score is \(\frac{\mathsf{Orbit}(n)}{b(n)} \times 1000\).
The following is a Python implementation of the score function to help you get started.
def score(n: [int]):
if len(n) > 1:
return None
n = n[0]
orbit = 0
magnitude = n.bit_length()
while n != 1:
if n % 2 == 1:
orbit += 1
n = 3 * n + 1
else:
n = n // 2
return int((orbit / magnitude) * 1000)