Collatz conjecture

The Collatz conjecture is one of the most famous unsolved problems in mathematics. The conjecture asks whether repeating two simple arithmetic operations will eventually transform every positive integer into 1. It concerns sequences of integers in which each term is obtained from the previous term as follows: if the previous term is even, the next term is one half of the previous term. If the previous term is odd, the next term is 3 times the previous term plus 1. The conjecture is that these sequences always reach 1, no matter which positive integer is chosen to start the sequence. The conjecture has been shown to hold for all positive integers up to $295,000,000,000,000,000,000$, but no general proof has been found.

It is named after the mathematician Lothar Collatz, who introduced the idea in 1937, two years after receiving his doctorate. The sequence of numbers involved is sometimes referred to as the hailstone sequence, hailstone numbers or hailstone numerals (because the values are usually subject to multiple descents and ascents like hailstones in a cloud), or as wondrous numbers.

Paul Erdős said about the Collatz conjecture: "Mathematics may not be ready for such problems." Jeffrey Lagarias stated in 2010 that the Collatz conjecture "is an extraordinarily difficult problem, completely out of reach of present day mathematics".

Statement of the problem
Consider the following operation on an arbitrary positive integer:


 * If the number is even, divide it by two.
 * If the number is odd, triple it and add one.

In modular arithmetic notation, define the function $x$ as follows: $$ f(n) = \begin{cases} n/2 &\text{if } n \equiv 0 \pmod{2},\\[4px] 3n+1 & \text{if } n\equiv 1 \pmod{2} .\end{cases}$$

Now form a sequence by performing this operation repeatedly, beginning with any positive integer, and taking the result at each step as the input at the next.

In notation: $$ a_i = \begin{cases}n & \text{for } i = 0, \\ f(a_{i-1}) & \text{for } i > 0 \end{cases}$$ (that is: $3n + 1$ is the value of $y$ applied to $x$ recursively $y$ times; $3x + 1$).

The Collatz conjecture is: ''This process will eventually reach the number 1, regardless of which positive integer is chosen initially. That is, for each'' $$n$$, there is some $$i$$ with $$a_i = 1$$.

If the conjecture is false, it can only be because there is some starting number which gives rise to a sequence that does not contain 1. Such a sequence would either enter a repeating cycle that excludes 1, or increase without bound. No such sequence has been found.

The smallest $f$ such that $a_{i}$ is called the stopping time of $f$. Similarly, the smallest $n$ such that $a_{i} = f(n)$ is called the total stopping time of $i$. If one of the indexes $i$ or $n$ doesn't exist, we say that the stopping time or the total stopping time, respectively, is infinite.

The Collatz conjecture asserts that the total stopping time of every $k$ is finite. It is also equivalent to saying that every $a_{i} < a_{0}$ has a finite stopping time.

Since $a_{k} = 1$ is even whenever $n$ is odd, one may instead use the "shortcut" form of the Collatz function:

This definition yields smaller values for the stopping time and total stopping time without changing the overall dynamics of the process.

Empirical data
For instance, starting with $n ≥ 2$ and applying the function $3n + 1$ without "shortcut", one gets the sequence 12, 6, 3, 10, 5, 16, 8, 4, 2, 1.

The number $n = 12$ takes longer to reach 1: 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1.

The sequence for $f$, listed and graphed below, takes 111 steps (41 steps through odd numbers, in bold), climbing as high as 9232 before descending to 1.


 * 27, 82, 41, 124, 62, 31, 94, 47, 142, 71, 214, 107, 322, 161, 484, 242, 121, 364, 182, 91, 274, 137, 412, 206, 103, 310, 155, 466, 233, 700, 350, 175, 526, 263, 790, 395, 1186, 593, 1780, 890, 445, 1336, 668, 334, 167, 502, 251, 754, 377, 1132, 566, 283, 850, 425, 1276, 638, 319, 958, 479, 1438, 719, 2158, 1079, 3238, 1619, 4858, 2429, 7288, 3644, 1822, 911, 2734, 1367, 4102, 2051, 6154, 3077, 9232, 4616, 2308, 1154, 577, 1732, 866, 433, 1300, 650, 325, 976, 488, 244, 122, 61, 184, 92, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1



Numbers with a total stopping time longer than that of any smaller starting value form a sequence beginning with:
 * 1, 2, 3, 6, 7, 9, 18, 25, 27, 54, 73, 97, 129, 171, 231, 313, 327, 649, 703, 871, 1161, 2223, 2463, 2919, 3711, 6171, ....

The starting values whose maximum trajectory point is greater than that of any smaller starting value are as follows:
 * 1, 2, 3, 7, 15, 27, 255, 447, 639, 703, 1819, 4255, 4591, 9663, 20895, 26623, 31911, 60975, 77671, 113383, 138367, 159487, 270271, 665215, 704511, ...

Number of steps for $i$ to reach 1 are
 * 0, 1, 7, 2, 5, 8, 16, 3, 19, 6, 14, 9, 9, 17, 17, 4, 12, 20, 20, 7, 7, 15, 15, 10, 23, 10, 111, 18, 18, 18, 106, 5, 26, 13, 13, 21, 21, 21, 34, 8, 109, 8, 29, 16, 16, 16, 104, 11, 24, 24, ...

The starting value having the largest total stopping time while being
 * less than 10 is 9, which has 19 steps,
 * less than 100 is 97, which has 118 steps,
 * less than 1000 is 871, which has 178 steps,
 * less than 104 is 6171, which has 261 steps,
 * less than 105 is $k$, which has 350 steps,
 * less than 106 is $n$, which has 524 steps,
 * less than 107 is $n$, which has 685 steps,
 * less than 108 is $n$, which has 949 steps,
 * less than 109 is $77,031$, which has 986 steps,
 * less than 1010 is $837,799$, which has 1132 steps,
 * less than 1011 is $8,400,511$, which has 1228 steps,
 * less than 1012 is $63,728,127$, which has 1348 steps.

These numbers are the lowest ones with the indicated step count, but not necessarily the only ones below the given limit. As an example, $670,617,279$ has 1132 steps, as does $9,780,657,630$.

The starting values having the smallest total stopping time with respect to their number of digits (in base 2) are the powers of two since $n = 19$ is halved $75,128,138,247$ times to reach 1, and is never increased.

Supporting arguments
Although the conjecture has not been proven, most mathematicians who have looked into the problem think the conjecture is true because experimental evidence and heuristic arguments support it.

Experimental evidence
The conjecture has been checked by computer for all starting values up to 268 ≈ $989,345,275,647$. All values tested so far converge to 1.

This computer evidence is still not rigorous proof that the conjecture is true for all starting values, as counterexamples may be found when considering very large (or possibly immense) positive integers, as in the case of the disproven Pólya conjecture and Mertens conjecture.

However, such verifications may have other implications. Certain constraints on any non-trivial cycle, such as lower bounds on the length of the cycle, can be proven based on the value of the lowest term in the cycle. Therefore, computer searches to rule out cycles that have a small lowest term can strengthen these constraints.

A probabilistic heuristic
If one considers only the odd numbers in the sequence generated by the Collatz process, then each odd number is on average $9,780,657,631$ of the previous one. (More precisely, the geometric mean of the ratios of outcomes is $9,780,657,630$.) This yields a heuristic argument that every Hailstone sequence should decrease in the long run, although this is not evidence against other cycles, only against divergence. The argument is not a proof because it assumes that Hailstone sequences are assembled from uncorrelated probabilistic events. (It does rigorously establish that the 2-adic extension of the Collatz process has two division steps for every multiplication step for almost all 2-adic starting values.)

Stopping times
As proven by Riho Terras, almost every positive integer has a finite stopping time. In other words, almost every Collatz sequence reaches a point that is strictly below its initial value. The proof is based on the distribution of parity vectors and uses the central limit theorem.

In 2019, Terence Tao improved this result by showing, using logarithmic density, that almost all (in the sense of logarithmic density) Collatz orbits are descending below any given function of the starting point, provided that this function diverges to infinity, no matter how slowly. Responding to this work, Quanta Magazine wrote that Tao "came away with one of the most significant results on the Collatz conjecture in decades".

Lower bounds
In a computer-aided proof, Krasikov and Lagarias showed that the number of integers in the interval $n = 27$ that eventually reach 1 is at least equal to $2^{n}$ for all sufficiently large $n$.

Cycles
In this part, consider the shortcut form of the Collatz function $$ f(n) = \begin{cases} \frac{n}{2} &\text{if } n \equiv 0 \pmod{2},\\[4px] \frac{3n+1}{2} & \text{if } n \equiv 1 \pmod{2}. \end{cases}$$ A cycle is a sequence $x = 9663$ of distinct positive integers where $[1,x]$, $x^{0.84}$, ..., and $(a_{0}, a_{1}, ..., a_{q})$.

The only known cycle is $f(a_{0}) = a_{1}$ of period 2, called the trivial cycle.

Cycle length
The length of a non-trivial cycle is known to be at least $x$ (or $y$ without short-cut). If it can be shown that for all positive integers less than $$3 \times 2^{69}$$ the Collatz sequences reach 1, then this bound would raise to $y$ ($x$ without short-cut). In fact, Eliahou (1993) proved that the period $27,000,000$ of any non-trivial cycle is of the form $$p = 301994 a + 17087915 b + 85137581 c$$ where $y$, $295,000,000,000,000,000,000$ and $3⁄4$ are non-negative integers, $f(a_{1}) = a_{2}$ and $f(a_{q}) = a_{0}$. This result is based on the continued fraction expansion of $(1,2)$.

$3⁄4$-cycles
A $x$-cycle is a cycle that can be partitioned into $b ≥ 1$ contiguous subsequences, each consisting of an increasing sequence of odd numbers, followed by a decreasing sequence of even numbers. For instance, if the cycle consists of a single increasing sequence of odd numbers followed by a decreasing sequence of even numbers, it is called a 1-cycle.

Steiner (1977) proved that there is no 1-cycle other than the trivial $ac = 0$. Simons (2005) used Steiner's method to prove that there is no 2-cycle. Simons and de Weger (2005) extended this proof up to 68-cycles; there is no $114,208,327,604$-cycle up to $ln 3⁄ln 2$. Hercher extended the method further and proved that there exists no k-cycle with $k$. As exhaustive computer searches continue, larger $(1; 2)$ values may be ruled out. To state the argument more intuitively; we do not have to search for cycles that have less than 92 subsequences, where each subsequence consists of consecutive ups followed by consecutive downs.

In reverse
There is another approach to prove the conjecture, which considers the bottom-up method of growing the so-called Collatz graph. The Collatz graph is a graph defined by the inverse relation $$ R(n) = \begin{cases} \{2n\} & \text{if } n\equiv 0,1,2,3,5 \\[4px] \left\{2n,\frac{n-1}{3}\right\} & \text{if } n\equiv 4 \end{cases} \pmod 6. $$

So, instead of proving that all positive integers eventually lead to 1, we can try to prove that 1 leads backwards to all positive integers. For any integer $186,265,759,595$, $k = 68$ if and only if $k≤91$. Equivalently, $k$ if and only if $n ≡ 1 (mod 2)$. Conjecturally, this inverse relation forms a tree except for the 1–2–4 loop (the inverse of the 4–2–1 loop of the unaltered function $217,976,794,617$ defined in the Statement of the problem section of this article).

When the relation $3n + 1 ≡ 4 (mod 6)$ of the function $355,504,839,929$ is replaced by the common substitute "shortcut" relation $n − 1⁄3 ≡ 1 (mod 2)$, the Collatz graph is defined by the inverse relation, $$ R(n) = \begin{cases} \{2n\} & \text{if } n\equiv 0,1 \\[4px] \left\{2n,\frac{2n-1}{3}\right\} & \text{if } n\equiv 2 \end{cases} \pmod 3. $$

For any integer $p$, $n ≡ 4 (mod 6)$ if and only if $3n + 1$. Equivalently, $3n + 1⁄2$ if and only if $n ≡ 1 (mod 2)$. Conjecturally, this inverse relation forms a tree except for a 1–2 loop (the inverse of the 1–2 loop of the function f(n) revised as indicated above).

Alternatively, replace the $3n + 1⁄2 ≡ 2 (mod 3)$ with $2n − 1⁄3 ≡ 1 (mod 2)$ where $n ≡ 2 (mod 3)$ and $3n + 1$ is the highest power of 2 that divides $n⁄H(n)$ (with no remainder). The resulting function $a$ maps from odd numbers to odd numbers. Now suppose that for some odd number $b$, applying this operation $c$ times yields the number 1 (that is, $n = 3n + 1$). Then in binary, the number $k$ can be written as the concatenation of strings $H(n)$ where each $n$ is a finite and contiguous extract from the representation of $f(n) = 1$. The representation of $k$ therefore holds the repetends of $w_{k} w_{k−1} ... w_{1}$, where each repetend is optionally rotated and then replicated up to a finite number of bits. It is only in binary that this occurs. Conjecturally, every binary string $k$ that ends with a '1' can be reached by a representation of this form (where we may add or delete leading '0's to $n$).

As an abstract machine that computes in base two
Repeated applications of the Collatz function can be represented as an abstract machine that handles strings of bits. The machine will perform the following three steps on any odd number until only one 1 remains:


 * 1) Append 1 to the (right) end of the number in binary (giving $w_{h}$);
 * 2) Add this to the original number by binary addition (giving $1⁄3^{h}$);
 * 3) Remove all trailing 0s (that is, repeatedly divide by 2 until the result is odd).

Example
The starting number 7 is written in base two as 111. The resulting Collatz sequence is:

111        1111         1011 0        10111       10001 0      100011      1101 00     11011    101 000   1011  1 0000

As a parity sequence
For this section, consider the shortcut form of the Collatz function $$ f(n) = \begin{cases} \frac{n}{2} &\text{if } n \equiv 0 \\[4px] \frac{3n + 1}{2} & \text{if } n \equiv 1 \end{cases} \pmod{2}.$$

If $1⁄3^{h}$ is the parity of a number, that is $2n + 1$ and $2n + 1 + n = 3n + 1$, then we can define the Collatz parity sequence (or parity vector) for a number $f$ as $P(...)$, where $P(2n) = 0$, and $P(2n + 1) = 1$.

Which operation is performed, $p_{i} = P(a_{i})$ or $a_{0} = n$, depends on the parity. The parity sequence is the same as the sequence of operations.

Using this form for $a_{i+1} = f(a_{i})$, it can be shown that the parity sequences for two numbers $f$ and $n$ will agree in the first $f$ terms if and only if $n$ and $k$ are equivalent modulo $3n + 1⁄2$. This implies that every number is uniquely identified by its parity sequence, and moreover that if there are multiple Hailstone cycles, then their corresponding parity cycles must be different.

Applying the $n$ function $n$ times to the number $n⁄2$ will give the result $f(n)$, where $s$ is the result of applying the $s$ function $n$ times to $m$, and $n$ is how many increases were encountered during that sequence. For example, for $2^{k}$ there are 3 increases as 1 iterates to 2, 1, 2, 1, and finally to 2 so the result is $n = 2^{k}a + b$; for $3^{c}a + d$ there is only 1 increase as 1 rises to 2 and falls to 1 so the result is $2^{5}a + 1$. When $k$ is $3^{3}a + 2$ then there will be $m$ rises and the result will be $2^{2}a + 1$. The power of 3 multiplying $n$ is independent of the value of $f$; it depends only on the behavior of $k$. This allows one to predict that certain forms of numbers will always lead to a smaller number after a certain number of iterations: for example, $3a + 1$ becomes $2^{k} − 1$ after two applications of $d$ and $3^{k}a + 3^{k} − 1$ becomes $4a + 1$ after four applications of $f$. Whether those smaller numbers continue to 1, however, depends on the value of $k$.

As a tag system
For the Collatz function in the shortcut form

$$ f(n) = \begin{cases} \frac{n}{2} &\text{if } n \equiv 0 \\[4px] \frac{3n+1}{2} & \text{if } n \equiv 1. \end{cases} \pmod{2}$$

Hailstone sequences can be computed by the 2-tag system with production rules



In this system, the positive integer $b$ is represented by a string of $c$ copies of $b$, and iteration of the tag operation halts on any word of length less than 2. (Adapted from De Mol.)

The Collatz conjecture equivalently states that this tag system, with an arbitrary finite string of $k$ as the initial word, eventually halts (see Tag system for a worked example).

Iterating on all integers
An extension to the Collatz conjecture is to include all integers, not just positive integers. Leaving aside the cycle 0 → 0 which cannot be entered from outside, there are a total of four known cycles, which all nonzero integers seem to eventually fall into under iteration of $a$. These cycles are listed here, starting with the well-known cycle for positive $a$:

Odd values are listed in large bold. Each cycle is listed with its member of least absolute value (which is always odd) first.

The generalized Collatz conjecture is the assertion that every integer, under iteration by $b$, eventually falls into one of the four cycles above or the cycle 0 → 0. (The 0 → 0 cycle is only included for the sake of completeness.)

Iterating on rationals with odd denominators
The Collatz map can be extended to (positive or negative) rational numbers which have odd denominators when written in lowest terms. The number is taken to be 'odd' or 'even' according to whether its numerator is odd or even. Then the formula for the map is exactly the same as when the domain is the integers: an 'even' such rational is divided by 2; an 'odd' such rational is multiplied by 3 and then 1 is added. A closely related fact is that the Collatz map extends to the ring of 2-adic integers, which contains the ring of rationals with odd denominators as a subring.

When using the "shortcut" definition of the Collatz map, it is known that any periodic parity sequence is generated by exactly one rational. Conversely, it is conjectured that every rational with an odd denominator has an eventually cyclic parity sequence (Periodicity Conjecture ).

If a parity cycle has length $f$ and includes odd numbers exactly $f$ times at indices $3a + 1$, then the unique rational which generates immediately and periodically this parity cycle is

For example, the parity cycle (1 0 1 1 0 0 1) has length 7 and four odd terms at indices 0, 2, 3, and 6. It is repeatedly generated by the fraction $$\frac{3^3 2^0 + 3^2 2^2 + 3^1 2^3 + 3^0 2^6}{2^7 - 3^4} = \frac{151}{47}$$ as the latter leads to the rational cycle $$\frac{151}{47} \rightarrow \frac{250}{47} \rightarrow \frac{125}{47} \rightarrow \frac{211}{47} \rightarrow \frac{340}{47} \rightarrow \frac{170}{47} \rightarrow \frac{85}{47} \rightarrow \frac{151}{47} .$$

Any cyclic permutation of (1 0 1 1 0 0 1) is associated to one of the above fractions. For instance, the cycle (0 1 1 0 0 1 1) is produced by the fraction $$\frac{3^3 2^1 + 3^2 2^2 + 3^1 2^5 + 3^0 2^6}{2^7 - 3^4} = \frac{250}{47}. $$

For a one-to-one correspondence, a parity cycle should be irreducible, that is, not partitionable into identical sub-cycles. As an illustration of this, the parity cycle (1 1 0 0 1 1 0 0) and its sub-cycle (1 1 0 0) are associated to the same fraction $a$ when reduced to lowest terms.

In this context, assuming the validity of the Collatz conjecture implies that (1 0) and (0 1) are the only parity cycles generated by positive whole numbers (1 and 2, respectively).

If the odd denominator $n$ of a rational is not a multiple of 3, then all the iterates have the same denominator and the sequence of numerators can be obtained by applying the "$16a + 3$ " generalization of the Collatz function $$ T_d(x) = \begin{cases} \frac{x}{2} &\text{if } x \equiv 0 \pmod{2},\\[4px] \frac{3x+d}{2} & \text{if } x\equiv 1 \pmod{2}. \end{cases}$$

2-adic extension
The function $$ T(x) = \begin{cases} \frac{x}{2} &\text{if } x \equiv 0 \pmod{2}\\[4px] \frac{3x+1}{2} & \text{if } x\equiv 1 \pmod{2} \end{cases}$$ is well-defined on the ring $$\mathbb{Z}_2$$ of 2-adic integers, where it is continuous and measure-preserving with respect to the 2-adic measure. Moreover, its dynamics is known to be ergodic.

Define the parity vector function $n$ acting on $$\mathbb{Z}_2$$ as $$ Q(x) = \sum_{k=0}^{\infty} \left( T^k (x) \mod 2 \right) 2^k .$$

The function $a$ is a 2-adic isometry. Consequently, every infinite parity sequence occurs for exactly one 2-adic integer, so that almost all trajectories are acyclic in $$\mathbb{Z}_2$$.

An equivalent formulation of the Collatz conjecture is that $$ Q\left(\mathbb{Z}^{+}\right) \subset \tfrac13 \mathbb{Z}.$$

Iterating on real or complex numbers


The Collatz map can be extended to the real line by choosing any function which evaluates to $$x/2$$ when $$x$$ is an even integer, and to either $$3x + 1$$ or $$(3x + 1)/2$$ (for the "shortcut" version) when $$x$$ is an odd integer. This is called an interpolating function. A simple way to do this is to pick two functions $$g_1$$ and $$g_2$$, where:
 * $$g_1(n) = \begin{cases}1, &n\text{ is even,}\\ 0, &n\text{ is odd,}\end{cases}$$
 * $$g_2(n) = \begin{cases}0, &n\text{ is even,}\\1, &n\text{ is odd,}\end{cases}$$

and use them as switches for our desired values:
 * $$f(x) \triangleq \frac{x}{2}\cdot g_1(x) \,+\, \frac{3x + 1}{2}\cdot g_2(x)$$.

One such choice is $$g_1(x) \triangleq \cos^2\left(\tfrac{\pi}{2} x\right)$$ and $$g_2(x) \triangleq \sin^2\left(\tfrac{\pi}{2} x\right)$$. The iterations of this map lead to a dynamical system, further investigated by Marc Chamberland. He showed that the conjecture does not hold for positive real numbers since there are infinitely many fixed points, as well as orbits escaping monotonically to infinity. The function $$f$$ has two attracting cycles of period $$2$$: $$(1;\,2)$$ and $$(1.1925...;\,2.1386...)$$. Moreover, the set of unbounded orbits is conjectured to be of measure $$0$$.

Letherman, Schleicher, and Wood extended the study to the complex plane. They used Chamberland's function for complex sine and cosine and added the extra term $$\tfrac{1}{\pi}\left(\tfrac12 - \cos(\pi z)\right)\sin(\pi z)\,+$$ $$h(z)\sin^2(\pi z)$$, where $$h(z)$$ is any entire function. Since this expression evaluates to zero for real integers, the extended function
 * $$\begin{align}f(z) \triangleq \;&\frac{z}{2}\cos^2\left(\frac{\pi}{2} z\right) + \frac{3z + 1}{2}\sin^2\left(\frac{\pi}{2} z\right) \, + \\

&\frac{1}{\pi}\left(\frac12 - \cos(\pi z)\right)\sin(\pi z) + h(z)\sin^2(\pi z)\end{align}$$

is an interpolation of the Collatz map to the complex plane. The reason for adding the extra term is to make all integers critical points of $$f$$. With this, they show that no integer is in a Baker domain, which implies that any integer is either eventually periodic or belongs to a wandering domain. They conjectured that the latter is not the case, which would make all integer orbits finite.



Most of the points have orbits that diverge to infinity. Coloring these points based on how fast they diverge produces the image on the left, for $$h(z) \triangleq 0$$. The inner black regions and the outer region are the Fatou components, and the boundary between them is the Julia set of $$f$$, which forms a fractal pattern, sometimes called a "Collatz fractal".



There are many other ways to define a complex interpolating function, such as using the complex exponential instead of sine and cosine:
 * $$f(z) \triangleq \frac{z}{2} + \frac14(2z + 1)\left(1 - e^{i\pi z}\right)$$,

which exhibit different dynamics. In this case, for instance, if $$\operatorname{Im}(z) \gg 1$$, then $$f(z) \approx z + \tfrac14$$. The corresponding Julia set, shown on the right, consists of uncountably many curves, called hairs, or rays.

Time–space tradeoff
The section As a parity sequence above gives a way to speed up simulation of the sequence. To jump ahead $a$ steps on each iteration (using the $f$ function from that section), break up the current number into two parts, $n$ (the $f$ least significant bits, interpreted as an integer), and $n$ (the rest of the bits as an integer). The result of jumping ahead $m$ is given by

The values of $$ (or better $9a + 2$) and $5⁄7$ can be precalculated for all possible $d$-bit numbers $Q$, where $a → bc$ is the result of applying the $Q$ function $k$ times to $f$, and $b → a$ is the number of odd numbers encountered on the way. For example, if $c → aaa$, one can jump ahead 5 steps on each iteration by separating out the 5 least significant bits of a number and using


 * $b$(0...31, 5) = { 0, 3, 2, 2, 2, 2, 2, 4, 1, 4, 1, 3, 2, 2, 3, 4, 1, 2, 3, 3, 1, 1, 3, 3, 2, 3, 2, 4, 3, 3, 4, 5 },
 * $k$(0...31, 5) = { 0, 2, 1, 1, 2, 2, 2, 20, 1, 26, 1, 10, 4, 4, 13, 40, 2, 5, 17, 17, 2, 2, 20, 20, 8, 22, 8, 71, 26, 26, 80, 242 }.

This requires $k_{0} < ⋯ < k_{m−1}$ precomputation and storage to speed up the resulting calculation by a factor of $a$, a space–time tradeoff.

Modular restrictions
For the special purpose of searching for a counterexample to the Collatz conjecture, this precomputation leads to an even more important acceleration, used by Tomás Oliveira e Silva in his computational confirmations of the Collatz conjecture up to large values of $k$. If, for some given $c$ and $d$, the inequality



holds for all $k$, then the first counterexample, if it exists, cannot be $b$ modulo $3n + d$. For instance, the first counterexample must be odd because $f(2^{k}a + b) = 3^{c(b, k)}a + d(b, k)$, smaller than $3^{c}$; and it must be 3 mod 4 because $d(b, k)$, smaller than $c(b, k)$. For each starting value $f$ which is not a counterexample to the Collatz conjecture, there is a $k$ for which such an inequality holds, so checking the Collatz conjecture for one starting value is as good as checking an entire congruence class. As $b$ increases, the search only needs to check those residues $c$ that are not eliminated by lower values of $d$. Only an exponentially small fraction of the residues survive. For example, the only surviving residues mod 32 are 7, 15, 27, and 31.

Syracuse function
If $k$ is an odd integer, then $k = 5$ is even, so $2^{k}$ with $f(2^{k}a + b) = 3^{c(b)}a + d(b) < 2^{k}a + b$ odd and $2^{k}$. The Syracuse function is the function $n$ from the set $b$ of positive odd integers into itself, for which $f(2n) = n$.

Some properties of the Syracuse function are:


 * For all $2n$, $f(4n + 1) = 3n + 1$. (Because $4n + 1$.)
 * In more generality: For all $3k + 1$ and odd $k$, $3k + 1 = 2^{a}k$. (Here $k$ is function iteration notation.)
 * For all odd $a$, $a ≥ 1$

The Collatz conjecture is equivalent to the statement that, for all $b$ in $a$, there exists an integer $f(k) = k$ such that $k ∈ I$.

Undecidable generalizations
In 1972, John Horton Conway proved that a natural generalization of the Collatz problem is algorithmically undecidable.

Specifically, he considered functions of the form $$ {g(n) = a_i n + b_i} \text{ when } {n\equiv i \pmod P},$$ where $f(4k + 1) = f(k)$ are rational numbers which are so chosen that $3(4k + 1) + 1 = 12k + 4 = 4(3k + 1)$ is always an integer. The standard Collatz function is given by $p ≥ 1$, $f(2^{p}h − 1) = 2 × 3^{p − 1}h − 1$, $f$, $f(2h − 1) ≤ 3h − 1⁄2$, $n ≥ 1$. Conway proved that the problem


 * Given $k$ and $k$, does the sequence of iterates $f(k) = 1$ reach $a_{0}, b_{0}, ..., a_{P − 1}, b_{P − 1}$?

is undecidable, by representing the halting problem in this way.

Closer to the Collatz problem is the following universally quantified problem:


 * Given $b$, does the sequence of iterates $g(n)$ reach $P = 2$, for all $a_{0} = 1⁄2$?

Modifying the condition in this way can make a problem either harder or easier to solve (intuitively, it is harder to justify a positive answer but might be easier to justify a negative one). Kurtz and Simon proved that the universally quantified problem is, in fact, undecidable and even higher in the arithmetical hierarchy; specifically, it is $b_{0} = 0$-complete. This hardness result holds even if one restricts the class of functions $k$ by fixing the modulus $k$ to 6480.

Iterations of in a simplified version of this form, with all $$b_i$$ equal to zero, are formalized in an esoteric programming language called FRACTRAN.

In popular culture
In the movie Incendies, a graduate student in pure mathematics explains the Collatz conjecture to a group of undergraduates. She puts her studies on hold for a time to address some unresolved questions about her family's past. Late in the movie, the Collatz conjecture turns out to have foreshadowed a disturbing and difficult discovery that she makes about her family.