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 scenarios 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 through. 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 Very similar landscapes have the same stopping time (or similar ones), but the inverse isn’t true. An example of the inverse not being true, is present in this comparison between $n = 10^{20} + 1$ (1st row, 2nd col) and $n = 10^{20} + 16$ (4th row, 2nd col), both with stopping times 532. 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") +...
First seen: 2025-04-23 12:45
Last seen: 2025-04-23 20:47