# Collatz function path pattern?

Definitions

$$C(n) = \begin{cases} n/2 & n\equiv 0\pmod2 \\ 3n+1 & n\equiv 1\pmod2 \end{cases}$$

Look at $C(n)$ for some $n$ and count how many times you multiply by $3$ before reaching $1$, and add $1$ to that count. Call this the second path length $L_2$ of that $n$ . Counting how many times we divide by two is the first path length $L_1$ of that $n$.

The path length of some $n$ is then just how many numbers $n$ jumps over before reaching $1$ (including $1$, since $1$ was added to the count of $L_2$) and is then $L_1+L_2$.

Trivial lengths can be directly seen in numbers of form $2^k$, which have $L_1=k$ and $L_2=1$ .

See the images if we take $L_1(n)\bmod9, L_2(n)\bmod6$, and $(L_1(n)+L_2(n))\bmod15$, for $n=1\dots10^6$ and color pixels in shades of white (black) depending on the value of these three sequences (such that consecutive remainders are close in shades of the color), we get the following patterns:

These particular $9,6,15$ mod values are the best for the smoothest transition of color shades.

Each pixel represents a single value of $a_n$, which were placed and colored on the images from left to right, from up to down. We can draw the graph from the center to the edges, in a spiral manner on a square lattice, and get the same patterns but spiralized:

The $L$ patterns form simple periodic regions which are increasing in size as $n$ grows.

Why do patterns look like that? What does that tells us?

Also; For comparison, you can see sequences $n\bmod k$ for same $k=6,9,15$ normal and spiral, here, for $n=1\dots4096$ (smaller images as their patterns are tiny and repeat exactly).

We can look at $L_2$ for example, and:

We can go ahead and use $6$ colors (red,yellow,green,cyan,blue,purple) for the $L_2$ pattern.

Plot $a_n=L_2(n)$ sequence such that we color lengths of form $(6k-5,6k-4,6k-3,6k-2,6k-1,6k)$ with the corresponding colors.

The shades of each of $6$ colors depend on $k$. We get the following image: Here is the spiral version.

What does this show? For example, numbers $900,000$ to $945,000$ are the numbers in the most bottom blue region, which means that if those numbers are plugged in the $C(n)$ function, we know that most $L_2$ paths of those $n$ will be of form $6k-1$.

Or for example, when picking a random number from the red interval (region), and plugging it into the collatz function, we are expecting to most likely perform $6k-5$ multiplications (actually $6k-6$ since $1$ was added in definition of $L_2$ at the beginning of the post) by $3$ before reaching $1$, where average $k$ depends on the size of $n$.

Was this observed before? Can one estimate the sizes of these periodic regions?
For $L_1,L_2$ and $L_1+L_2$?

Can this tell us anything about the collatz function or is it just a neat observation?

Why are $L_2\bmod6$ and $L_1\bmod9$ least messy patterns?

For example, using $L_2\bmod 5$ instead of $L_2\bmod6$ (and coloring), we get this mess.

Using $2,3,4$ are still almost as nice as $6$, but after that its similar to $5$.

• These graphs reminded me of Kirby Banman's visualization he called, "Eye of Collatz". kdbanman.com/2016/09/23/eye-of-collatz Banman used a different method involving a spiral grid, but Banman's visualizations also had a "stripe" effect. – Griffon Theorist697 Jan 12 '18 at 4:36

The more $n$ is big, the more you have successive numbers having the same $L_x$ values (...and modulo). I didn't explore this yet.
$\small n\quad\quad\quad \scriptsize L_2(n)\> L_1(n) \quad \text{number of division by two (comma$\to$3n+1) to reach 1:}\\ ...\\ 900310\quad26\quad61\quad(1,1,2,2,1,2,2,2,1,8,2,2,2,1,1,3,2,2,1,1,1,3,2,4,1,1,10)\\ 900311\quad26\quad61\quad(0,1,1,4,1,2,2,2,1,8,2,2,2,1,1,3,2,2,1,1,1,3,2,4,1,1,10)\\ 900312\quad26\quad61\quad(3,1,2,1,1,1,4,1,1,3,2,3,4,3,2,1,2,2,1,1,1,3,2,4,1,1,10)\\ 900313\quad26\quad61\quad(0,2,1,5,1,2,2,1,1,3,2,3,4,3,2,1,2,2,1,1,1,3,2,4,1,1,10)\\ 900314\quad26\quad61\quad(1,3,2,1,1,1,4,1,1,3,2,3,4,3,2,1,2,2,1,1,1,3,2,4,1,1,10)\\ 900315\quad26\quad61\quad(0,1,2,1,1,3,4,3,2,1,2,3,4,3,2,1,2,2,1,1,1,3,2,4,1,1,10)\\ 900316\quad26\quad61\quad(2,1,1,3,1,1,4,1,1,3,2,3,4,3,2,1,2,2,1,1,1,3,2,4,1,1,10)\\ 900317\quad26\quad61\quad(0,3,1,3,1,1,4,1,1,3,2,3,4,3,2,1,2,2,1,1,1,3,2,4,1,1,10)\\ ...\\ 901474\quad17\quad47...\\ 901475\quad17\quad47...\\ 901476\quad17\quad47...\\ 901477\quad17\quad47...\\ 901478\quad17\quad47...\\ ...\\ 902209\quad53\quad104...\\ 902210\quad53\quad104...\\ 902211\quad53\quad104...\\ 902212\quad53\quad104...\\ 902213\quad53\quad104...\\ 902214\quad53\quad104...\\ ...$
The ratio $\frac{L_1(n)}{L_2(n)}$ is also discussed here: (What causes this apparent pattern in hailstone sequences?)