The Collatz Map in Binary

Strip the zeros, then watch a carry ripple: the most famous open problem in arithmetic is a statement about bit-strings.

The Collatz map is defined by

c(x)={x/2x even3x+1x odd,c(x) = \begin{cases} x/2 & x \text{ even} \\ 3x + 1 & x \text{ odd,} \end{cases}

and the Collatz problem asks: does every positive integer, iterated under cc, eventually reach the trivial cycle 4214 \to 2 \to 1?

Nobody knows. But the problem changes texture if you stop thinking of cc as arithmetic on numbers and start thinking of it as an operation on binary strings. Division by two, the part that feels dynamical, becomes trivial, and everything interesting concentrates in a single carry chain.

Seven

Start with seven. In binary it is 111111: three ones, nothing else. Everything that follows is an operation on this string.

The odd branch

Seven is odd, so the map adds the string to a copy of itself shifted up one place, with a carry seeded at the bottom. The sum always ends in a zero, which falls off immediately. That takes 111111 to 10111011, then 10111011 to 1000110001. The string is getting longer.

Stripping zeros

One more odd step takes 1717 to 2626, an even number at last. The even branch does no arithmetic at all: the trailing zero, marked in red, is simply deleted, and what remains is 11011101, thirteen. In binary, halving is not dynamics, it is deletion.

Shrinking

From 1313 the odd branch gives 2020, which is 1010010100: two zeros at the bottom this time. Both vanish at once and the string collapses to 101101, five. The string only shrinks when zeros reach the bottom edge.

Reaching one

Five is odd, and one more carry chain produces 88, which is 10001000. Three trailing zeros, three deletions, and we land on 11. The deletions win, this time.

The open question

That is the whole game: the odd branch grows the string and stirs it with carries, while the even branch deletes zeros off the bottom. For seven, the deletions won after five odd steps. Nobody has ever found a starting value that escapes, and nobody has proved that none does.

The trajectory of seven under the accelerated Collatz map, in binarythe trajectory of sevenodd: add shifted copyeven: strip zeros7111111011+shift1710001+shift2611010+shift1311012010100+shift510181000+shift11

An accelerated map

First, compress the boring steps. Let ν2(x)\nu_2(x) be the exponent of the largest power of two dividing xx, and define

d(x)={x/2ν2(x)x even(3x+1)/2x odd.d(x) = \begin{cases} x / 2^{\nu_2(x)} & x \text{ even} \\ (3x+1)/2 & x \text{ odd.} \end{cases}

This is the standard “accelerated” Collatz map: it does all consecutive halvings at once (note 3x+13x + 1 is always even when xx is odd, so the odd branch can safely include one halving).

In binary, the even branch is not arithmetic at all. Dividing by 2ν2(x)2^{\nu_2(x)} just deletes the trailing zeros from the representation. Writing bits least-significant first, the even case is “strip leading 0s”: pure string surgery.

So all the depth of the Collatz problem lives in the odd branch. What does (3x+1)/2(3x+1)/2 do to a bit-string?

Unpacking the odd branch

Write an odd xx as a list of bits, least significant first, so x=1:x1:x2:x3:x = 1 : x_1 : x_2 : x_3 : \cdots (the first bit is 1 because xx is odd). Since 3x+1=(2x+1)+x3x + 1 = (2x + 1) + x, and 2x+12x + 1 in this representation is just 1 : x (shift left, set the low bit), we have

(3x+1)/2  =  tail(add(x,  1:x)),(3x+1)/2 \;=\; \mathrm{tail}\,\big(\mathrm{add}(x,\; 1 : x)\big),

where add is ordinary binary addition. Here is the addition algorithm, bits-first, with an explicit carry; maj is the majority function that decides when a carry propagates:

add :: [Bool] -> [Bool] -> [Bool]
add xs ys = adder xs ys False
  where
    adder (x : xs) (y : ys) c = (x  y  c) : adder xs ys (maj x y c)
    adder []       (y : ys) c = (y  c)     : adder [] ys (y && c)
    adder (x : xs) []       c = (x  c)     : adder xs [] (x && c)
    adder []       []       True  = [True]
    adder []       []       False = []

    maj x y z = fromEnum x + fromEnum y + fromEnum z >= 2
    x  y     = x /= y

Now run adder on xx and 1:x1 : x by hand. The two inputs are the same string, offset by one position, so bit kk of the sum combines xkx_k, xk1x_{k-1}, and the incoming carry. The first additions look like:

bit 0:  110=0,carry 1bit 1:  x111=x1,carry maj(x1,1,1)=1bit 2:  x2x11,carry c2=maj(x2,x1,1)bit k:  xkxk1ck1,carry ck=maj(xk,xk1,ck1).\begin{aligned} \text{bit } 0 &: \; 1 \oplus 1 \oplus 0 = 0, && \text{carry } 1 \\ \text{bit } 1 &: \; x_1 \oplus 1 \oplus 1 = x_1, && \text{carry } \mathrm{maj}(x_1, 1, 1) = 1 \\ \text{bit } 2 &: \; x_2 \oplus x_1 \oplus 1, && \text{carry } c_2 = \mathrm{maj}(x_2, x_1, 1) \\ \text{bit } k &: \; x_k \oplus x_{k-1} \oplus c_{k-1}, && \text{carry } c_k = \mathrm{maj}(x_k, x_{k-1}, c_{k-1}). \end{aligned}

Bit 0 of the sum is 0; that is the guaranteed factor of two, and the tail\mathrm{tail} deletes it. What remains is the new odd-branch output:

d(x)k  =  xk+1xkck,ck+1=maj(xk+1,xk,ck),c0=1.d(x)_k \;=\; x_{k+1} \oplus x_k \oplus c_k, \qquad c_{k+1} = \mathrm{maj}(x_{k+1}, x_k, c_k), \qquad c_0 = 1.

What this buys you

Seen this way, one step of the accelerated Collatz map is:

  1. XOR the string with itself shifted by one, perturbed by a carry that ripples from the bottom, then
  2. strip the trailing zeros that the XOR produced.

The 3x+13x+1 mystery is gone; in its place is a question about how a self-similar carry chain interacts with zero-stripping. An output bit is 0 exactly where xk+1xk=ckx_{k+1} \oplus x_k = c_k: where the string’s disagreement with its own shift matches the incoming carry. Zeros at the bottom of the string get deleted and the number shrinks; everywhere the carry chain and the shift pattern fail to cancel, ones survive and the number stays large.

That is the Collatz problem restated: does this carry process always eventually manufacture enough cancellation at the bottom of the string that the deletions win? Phrased over bit-strings it looks less like dynamics and more like a problem about a one-dimensional cellular automaton. No closer to solved, but a much stranger and more concrete thing to stare at.