The collatz conjecture states that every number eventually reaches $1$ under the repeated iteration of
$$ f_0(n) =
\begin{cases}
n/2, & \text{if $n$ even} \\
3n+1, & \text{else}
\end{cases}$$
As a number is guaranteed to be even after the $3n+1$ step, one can replace $f_0(n)$ with
$$ f_1(n) =
\begin{cases}
n/2, & \text{if $n$ even} \\
\frac{3n+1}{2}, & \text{else}
\end{cases}$$
and obtain an equivalent conjecture.
One can tabulate the possible expressions that can arise from applying $f_1$ to $n$ $x$ times, as is shown in the following table.
\begin{array}{|c|c|c|c|}
\hline
\frac{n}{2^1}& \frac{n}{2^2} & \frac{n}{2^3} & \frac{n}{2^4} \\ \hline
\frac{3^1n+1}{2^1}& \frac{3^1n+1\cdot2^1}{2^2} & \frac{3^1n+1\cdot2^2}{2^3} & \frac{3^1n+1\cdot2^3}{2^4}\\ \hline
& \frac{3^1n+1\cdot2^0}{2^2} & \frac{3^1n+1\cdot2^1}{2^3} &\frac{3^1n+1\cdot2^2}{2^4}\\ \hline
& \frac{3^2n+5\cdot2^0}{2^2} & \frac{3^2n+5\cdot2^1}{2^3}& \frac{3^2n+5\cdot2^2}{2^4}\\ \hline
& &\frac{3^1n+1\cdot2^0}{2^3} & \frac{3^1n+1\cdot2^1}{2^4}
\end{array}
Let $x$ be the column index and the number of iterations, starting at $1$.
Let $y$ be the row index, starting at $0$.
The content of cell $x,y$ is $f_1$ applied to the content of cell $x-1,\lfloor\frac{y}{2}\rfloor$. The parity of $y$ decides which 'path' of $f_1$ (even or odd) is taken. Or formulated another way: the table is built up recursively. Column 1 row 0 was the input for column 2 rows 0 and 1. Column 1 row 1 was the input for column 2 rows 2 and 3 and so on. The resulting large fractions are then factored into this form.
I've pasted the html of a table for the first 8 iterations to this page.
When written this way, the expressions exhibit some nice pattern, namely:
Every expression (apart from row 0) is of the form
$$ \frac{3^bn+q\cdot2^d}{2^x} $$
where $b$ is the hamming weight of $y$, i.e. the number of 1-bits in it's binary representation and $d = x – \log_2 (c) + 1$ with $c$ being the greatest power of 2 $\leq y$.
$q$ is the only thing which seems not be as easily parameterisable. However, it seems to be somehow similar to A035109, which is defined as
$$ \frac{1}{n}\sum_{d \mid n}{\mu\left(\frac{n}{d}\right)\sum_{e\mid d} e\sum_{\substack{e\mid d \\ e \text{ odd}}}e} $$
The first values of q are:
$0,1,1,5,1,7,5,19,1,11,7,29,5,23,19,65,1,19,\dots$ More can be read out from the linked table.
My question is: what formula could generate this sequence?
Best Answer
Update - solution
It seems, a valid pattern is been indicated by the following picture, where your values $q$ are ordered in a binary (or ternary?) tree:
I've sometimes seen sequences which have such a "binary tree" pattern. If it is really appropriate for your problem, this knowledge might be helpful to detect a generating formula. If this pattern is indeed correct, then I have a simple function to determine the value of $q$ at any index:
checking:
first 12 values:
old text of answer
Unfortunately I didn't see how to implement computation of the squence of q's so I couldn't make it more likely that this binary pattern actually exists.
The numbers $1,5,19,65,211,...$ are likely best interpreted as differences of the type $3^n-2^n$ And many other numbers can be described as other difference of powers of 3 and 2, like
Also, $1,7,29,103,341,...$ can be described as $1$, $7=3\cdot 1+4$, $29= 3\cdot 7+8$, $103 = 3 \cdot 29+16$, $341 = 3\cdot 103 + 32$, $...$ but I think it is too much for me at the moment to proceed here.
If we follow the right-down arrows (black and grey) then there is a so simple pattern that I'm sure this is the best way to define the tree (and from this the sequence)
I've just copied the first 256 numbers $q$ from the linked list in the OP. See:
It seems a representation as numbers $6k \pm 1$ or $6k+1$,$6k+5$ could be helpful.