Collatz's Ant and similarity of collatz sequences

This is a brief continuation of a previous post (Repo), which introduced such visualization for collatz sequences based on Langton’s Ant.

Collatz’s Ant is based on the collatz function:

\[f(n) = \begin{cases} n/2 & \text{if} \quad n \equiv 0 \quad (\text{mod}\, 2) \\ 3n + 1 & \text{if} \quad n \equiv 1 \quad (\text{mod}\, 2) \\ \end{cases}\]

and additionally, if $n \equiv 0 \, (\text{mod}\, 2)$ the ant turns 90º clockwise, else the ant turns 90º counter-clockwise. On both accounts, the state of the cell is flipped and the ant moves forward one unit. This is repeated until $n = 1$. An example of such is present in the following animation:

Example of consecutive trajectories from $n = 10^{40}$ to $n = 10^{40} + 20$.

And although this representation is interesting, the flipping of state can eventually lead to ambiguous scenarios1 where trajectories seem similar to each other through omission.

Given that, the following picture corresponds to the ant’s landscape (final snapshot) without state flipping for the same trajectories, along with respective stopping times. This is done by merely adding a $+1$ count to each coordinate the ant has been through2.

Some other examples

The first 100 numbers from $n = 2$ to $n = 102$.

From $n = 10^{9}$ to $n = 10^{9} + 100$.

From $n = 10^{20}$ to $n = 10^{20} + 100$.

From $n = 10^{200}$ to $n = 10^{200} + 10$.

Some interesting things

If we check the similarity between both of these trajectories:

import numpy as np
import mpmath

def collatz_seq(n):
    seq = []
    while n != 1:
        seq.append(n)
        if n % 2 == 0:
        	n /= 2
        else:
        	n = 3*n + 1
    return seq

mpmath.mp.dps = 22
n1 = mpmath.mpf("1e20") + 1
n2 = mpmath.mpf("1e20") + 16
len(np.intersect1d(collatz_seq(n1), collatz_seq(n2)))
Output: 142

If the same is done between $n = 10^{20} + 16$ and $n = 10^{20} + 20$, which have similar landscapes and the same stopping time, we get:

Output: 527

Example with $n = 18750000000000000004$ and $n = 10^{20} + 16$, the former being found after 5 reduction steps of the latter.

Now with a difference of 100 steps, the landscapes still seem very similar but for a rotation of 180º.

With a difference of 200 steps, the landscapes start losing some detail relative to each other.

And with 300 steps, only a few larger-scale characteristics are now common between the two landscapes.

Back