Collatz conjecture


The Collatz conjecture is one of the most famous List of [unsolved problems in mathematics|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 a term is even, the next term is one half of it. If a 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, 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, 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". However, though the Collatz conjecture itself remains open, efforts to solve the problem have led to new techniques and many partial results.

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 as follows:
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:
.
The Collatz conjecture is: This process will eventually reach the number 1, regardless of which positive integer is chosen initially. That is, for each, there is some with.
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 such that is called the stopping time of. Similarly, the smallest such that is called the total stopping time of. If one of the indexes or does not 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 is finite. It is also equivalent to saying that every has a finite stopping time.
Since is even whenever 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 and applying the function without "shortcut", one gets the sequence.
The number takes longer to reach 1:.
The sequence for, listed and graphed below, takes 111 steps, climbing as high as 9232 before descending to 1.
Numbers with a total stopping time longer than that of any smaller starting value form a sequence beginning with:
The starting values whose maximum trajectory point is greater than that of any smaller starting value are as follows:
Number of steps for to reach 1 are
The starting value having the largest total stopping time while being
These numbers are the lowest ones with the indicated step count, but not necessarily the only ones below the given limit. As an example, has 1132 steps, as does.
The starting values having the smallest total stopping time with respect to their number of digits are the powers of two, since is halved times to reach 1, and it 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 271 ≈. 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 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 of the previous one. 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, however, because it assumes that Hailstone sequences are assembled from uncorrelated probabilistic events.

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 Collatz orbits descend 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 that eventually reach 1 is at least equal to for all sufficiently large.

Cycles

In this part, consider the shortcut form of the Collatz function
A cycle is a sequence of distinct positive integers where,,..., and.
The only known cycle is of period 2, called the trivial cycle.

Cycle length

As of 2025, the best known bound on cycle length is . In 1993, Eliahou proved that the period of any non-trivial cycle is of the form
where, and are non-negative integers, and. This result is based on the simple continued fraction expansion of.

-cycles

A -cycle is a cycle that can be partitioned into 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 proved that there is no 1-cycle other than the trivial. Simons used Steiner's method to prove that there is no 2-cycle. Simons and de Weger extended this proof up to 68-cycles; there is no -cycle up to. Hercher extended the method further and proved that there exists no k-cycle with. As exhaustive computer searches continue, larger 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.

Other formulations of the conjecture

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
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, if and only if. Equivalently, if and only if. Conjecturally, this inverse relation forms a tree for positive integers except for the 1–2–4 loop.
When the relation of the function is replaced by the common substitute "shortcut" relation, the Collatz graph is defined by the inverse relation,
For any integer, if and only if. Equivalently, if and only if. Conjecturally, this inverse relation forms a tree for positive integers except for a 1–2 loop.
Alternatively, replace the with where and is the highest power of 2 that divides . The resulting function maps from odd numbers to odd numbers. Now suppose that for some odd number, applying this operation times yields the number 1. Then in binary, the number can be written as the concatenation of strings where each is a finite and contiguous extract from the representation of. The representation of therefore holds the repetends of, 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 that ends with a '1' can be reached by a representation of this form.

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 remains:
  1. Append to the end of the number in binary ;
  2. Add this to the original number by binary addition ;
  3. Remove all trailing s.

Example

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

111
1111
10110
10111
100010
100011
110100
11011
101000
1011
10000

As a [|parity sequence]

For this section, consider the shortcut form of the Collatz function
If is the parity of a number, that is and, then we can define the Collatz parity sequence for a number as, where, and.
Which operation is performed, or, depends on the parity. The parity sequence is the same as the sequence of operations.
Using this form for, it can be shown that the parity sequences for two numbers and will agree in the first terms if and only if and are equivalent modulo. 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 function times to the number will give the result, where is the result of applying the function times to, and is how many increases were encountered during that sequence. For example, for there are 3 increases as 1 iterates to 2, 1, 2, 1, and finally to 2 so the result is ; for there is only 1 increase as 1 rises to 2 and falls to 1 so the result is. When is then there will be rises and the result will be. The power of 3 multiplying is independent of the value of ; it depends only on the behavior of. 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, becomes after two applications of and becomes after four applications of. Whether those smaller numbers continue to 1, however, depends on the value of.

As a tag system

For the Collatz function in the shortcut form
Hailstone sequences can be computed by the 2-tag system with production rules
In this system, the positive integer is represented by a string of copies of, and iteration of the tag operation halts on any word of length less than 2.
The Collatz conjecture equivalently states that this tag system, with an arbitrary finite string of as the initial word, eventually halts.

Extensions to larger domains

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. These cycles are listed here, starting with the well-known cycle for positive :
Odd values are listed in large bold. Each cycle is listed with its member of least absolute value first.
CycleOdd-value cycle lengthFull cycle length
1 → 4 → 2 → 1 ...13
−1 → −2 → −1 ...12
−5 → −14 → −7 → −20 → −10 → −5 ...25
−17 → −50 → −25 → −74 → −37 → −110 → −55 → −164 → −82 → −41 → −122 → −61 → −182 → −91 → −272 → −136 → −68 → −34 → −17 ...718

The generalized Collatz conjecture is the assertion that every integer, under iteration by, eventually falls into one of the four cycles above or the cycle 0 → 0.

Iterating on rationals with odd denominators

The Collatz map can be extended to 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.
If a parity cycle has length and includes odd numbers exactly times at indices, then the unique rational which generates immediately and periodically this parity cycle is
For example, the parity cycle has length 7 and four odd terms at indices 0, 2, 3, and 6. It is repeatedly generated by the fraction
as the latter leads to the rational cycle
Any cyclic permutation of is associated to one of the above fractions. For instance, the cycle is produced by the fraction
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 and its sub-cycle are associated to the same fraction when reduced to lowest terms.
In this context, assuming the validity of the Collatz conjecture implies that and are the only parity cycles generated by positive whole numbers.
If the odd denominator 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 " " generalization of the Collatz function

2-adic extension

The function
is well-defined on the ring 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 acting on as
The function 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.
An equivalent formulation of the Collatz conjecture is that

Iterating on real or complex numbers

The Collatz map can be extended to the real line by choosing any function which evaluates to when is an even integer, and to either or when is an odd integer. This is called an interpolating function. A simple way to do this is to pick two functions and, where:
and use them as switches for our desired values:
One such choice is and. 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 has two attracting cycles of period : and. Moreover, the set of unbounded orbits is conjectured to be of measure.
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
, where is any entire function. Since this expression evaluates to zero for real integers, the extended function
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. 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. The inner black regions and the outer region are the Fatou components, and the boundary between them is the Julia set of, 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:
which exhibit different dynamics. In this case, for instance, if, then. The corresponding Julia set, shown on the right, consists of uncountably many curves, called hairs, or rays.

Optimizations

Time–space tradeoff

The section As a parity sequence above gives a way to speed up simulation of the sequence. To jump ahead steps on each iteration, break up the current number into two parts, , and . The result of jumping ahead is given by
The values of and can be precalculated for all possible -bit numbers, where is the result of applying the function times to, and is the number of odd numbers encountered on the way. For example, if, one can jump ahead 5 steps on each iteration by separating out the 5 least significant bits of a number and using
This requires precomputation and storage to speed up the resulting calculation by a factor of, 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 . If, for some given and, the inequality
holds for all, then the first counterexample, if it exists, cannot be modulo. For instance, the first counterexample must be odd because, smaller than ; and it must be 3 mod 4 because, smaller than. For each starting value which is not a counterexample to the Collatz conjecture, there is a 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 increases, the search only needs to check those residues that are not eliminated by lower values of . Only an exponentially small fraction of the residues survive. For example, the only surviving residues mod 32 are 7, 15, 27, and 31.
Integers divisible by 3 cannot form a cycle, so these integers do not need to be checked as counterexamples.

Syracuse function

If is an odd integer, then is even, so with odd and. The Syracuse function is the function from the set of positive odd integers into itself, for which .
Some properties of the Syracuse function are:
  • For all,.
  • In more generality: For all and odd,.
  • For all odd,
The Collatz conjecture is equivalent to the statement that, for all in, there exists an integer such that.

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
where are rational numbers which are so chosen that is always an integer. The standard Collatz function is given by,,,,. Conway proved that the problem
is undecidable, by representing the halting problem in this way.
Closer to the Collatz problem is the following universally quantified problem:
Modifying the condition in this way can make a problem either harder or easier to solve. Kurtz and Simon proved that the universally quantified problem is, in fact, undecidable and even higher in the arithmetical hierarchy; specifically, it is -complete. This hardness result holds even if one restricts the class of functions by fixing the modulus to 6480.
Iterations of in a simplified version of this form, with all equal to zero, are formalized in an esoteric programming language called FRACTRAN.

In computational complexity

The Collatz and related conjectures are often used when studying computational complexity. The connection is made through the busy beaver function, where BB is the maximum number of steps taken by any n state Turing machine that halts. There is a 15 state Turing machine that halts if and only if the following conjecture by Paul Erdős is false: for all n > 8 there is at least one digit 2 in the base 3 representation of 2n. Hence if BB was known, and this machine did not stop in that number of steps, it would be known to run forever and hence no counterexamples exist. This is a completely impractical way to settle the conjecture; instead it is used to suggest that BB will be very hard to compute, at least as difficult as settling this Collatz-like conjecture.
In 2024, a six-state machine was found for which determining whether it halts involves solving a Collatz-like problem called the antihydra problem. As proofs of even simple conjectures of this nature are not currently known, this suggests that BB will be very hard to compute.