Collatz Problem

DOWNLOAD Mathematica Notebook

A problem posed by L. Collatz in 1937, also called the 3x+1 mapping, 3n+1 problem, Hasse's algorithm, Kakutani's problem, Syracuse algorithm, Syracuse problem, Thwaites conjecture, and Ulam's problem (Lagarias 1985). Thwaites (1996) has offered a £1000 reward for resolving the conjecture. Let a_0 be an integer. Then one form of Collatz problem asks if iterating

 a_n={1/2a_(n-1)   for a_(n-1) even; 3a_(n-1)+1   for a_(n-1) odd
(1)

always returns to 1 for positive a_0. (If negative numbers are included, there are four known cycles (excluding the trivial 0 cycle): (4, 2, 1), (-2, -1), (-5, -14, -7, -20, -10), and (-17, -50, -25, -74, -37, -110, -55, -164, -82, -41, -122, -61, -182, -91, -272, -136, -68, -34).)

The members of the sequence produced by the Collatz are sometimes known as hailstone numbers. Conway proved that the original Collatz problem has no nontrivial cycles of length <400. Lagarias (1985) showed that there are no nontrivial cycles with length <275000. Conway (1972) also proved that Collatz-type problems can be formally undecidable. Kurtz and Simon (2007) proved that a natural generalization of the Collatz problem is undecidable; unfortunately, this proof cannot be applied to the original Collatz problem.

The Collatz algorithm has been tested and found to always reach 1 for all numbers <=19·2^(58) approx 5.48×10^(18) (Oliveira e Silva 2008), improving the earlier results of 10^(15) (Vardi 1991, p. 129) and 5.6×10^(13) (Leavens and Vermeulen 1992). Because of the difficulty in solving this problem, Erdős commented that "mathematics is not yet ready for such problems" (Lagarias 1985).

The following table gives the sequences obtained for the first few starting values (OEIS A070165).

a_0a_0, a_1, a_2, ...
11
22, 1
33, 10, 5, 16, 8, 4, 2, 1
44, 2, 1
55, 16, 8, 4, 2, 1
66, 3, 10, 5, 16, 8, 4, 2, 1
CollatzSteps

The numbers of steps required for the algorithm to reach 1 for a_0=1, 2, ... are 0, 1, 7, 2, 5, 8, 16, 3, 19, 6, 14, 9, 9, 17, 17, 4, 12, 20, 20, 7, ... (OEIS A006577; illustrated above). Of these, the numbers of tripling steps are 0, 0, 2, 0, 1, 2, 5, 0, 6, ... (OEIS A006667), and the number of halving steps are 0, 1, 5, 2, 4, 6, 11, 3, 13, ... (OEIS A006666). The smallest starting values of a_0 that yields a Collatz sequence containing n=1, 2, ... are 1, 2, 3, 3, 3, 6, 7, 3, 9, 3, 7, 12, 7, 9, 15, 3, 7, 18, 19, ... (OEIS A070167).

The Collatz problem can be implemented as an 8-register machine (Wolfram 2002, p. 100), quasi-cellular automaton (Cloney et al. 1987, Bruschi 2005), or 6-color one-dimensional quasi-cellular automaton with local rules but which wraps first and last digits around (Zeleny). In general, the difficulty in constructing true local-rule cellular automata arises from the necessity of a carry operation when multiplying by 3 which, in the worst case, can extend the entire length of the base-b representation of digits (and thus require propagating information at faster than the CA's speed of light).

The Collatz problem was modified by Terras (1976, 1979), who asked if iterating

 t_n={1/2t_(n-1)   for t_(n-1) even; 1/2(3t_(n-1)+1)   for t_(n-1) odd
(2)

always returns to 1 for initial integer value t_0 (e.g., Lagarias 1985, Cloney et al. 1987). This is simply the original statement above but combining the division by two into the addition step if t_(n-1) is odd, thus compressing the number of steps. The following table gives the sequences for the first few starting values t_0=1, 2, ... (OEIS A070168).

t_0t_1, t_2, ...
11
22, 1
33, 5, 8, 4, 2, 1
44, 2, 1
55, 8, 4, 2, 1
66, 3, 5, 8, 4, 2, 1
77, 11, 17, 26, 13, 20, 10, 5, 8, 4, 2, 1

If negative numbers are included, there are 4 known cycles: (1, 2), (-1), (-5, -7, -10), and (-17, -25, -37, -55, -82, -41, -61, -91, -136, -68, -34). It is a special case of the "generalized Collatz problem" with d=2, m_0=1, m_1=3, r_0=0, and r_1=-1. Terras (1976, 1979) also proved that the set of integers S_k={n:n has stopping time <=k} has a limiting asymptotic density F(k), such that if N_x(k) is the number of n such that n<=x and sigma(n)<=k, then the limit

 F(k)=lim_(x->infty)(N_x(k))/x,
(3)

exists. Furthermore, F(k)->1 as k->infty, so almost all integers have a finite stopping time. Finally, for all k>=1,

 1-F(k)=lim_(x->infty)(N_x(k))/x<=2^(-etak),
(4)

where

H(x)=-xlgx-(1-x)lg(1-x)
(5)
theta=1/(lg3)
(6)
eta=1-H(theta)=0.05004...
(7)

(Lagarias 1985).

A generalization of the Collatz problem lets d>=2 be a positive integer and m_0, ..., m_(d-1) be nonzero integers. Also let r_i in Z satisfy

 r_i=im_i (mod d).
(8)

Then

 T(x)=(m_ix-r_i)/d
(9)

for x=i (mod d) defines a generalized Collatz mapping. An equivalent form is

 T(x)=|_(m_ix)/d_|+X_i
(10)

for x=i (mod d) where X_0, ..., X_(d-1) are integers and |_r_| is the floor function. The problem is connected with ergodic theory and Markov chains. Matthews obtained the following table for the mapping

 T_k(x)={1/2x   for x=0 (mod 2); 1/2(3x+k)   for x=1 (mod 2),
(11)

where k=T_(5^k).

k# cyclesmax. cycle length
0527
11034
213118
317118
419118
521165
623433

Matthews and Watts (1984) proposed the following conjectures.

1. If |m_0...m_(d-1)|<d^d, then all trajectories {T^K(n)} for n in Z eventually cycle.

2. If |m_0...m_(d-1)|>d^d, then almost all trajectories {T^K(n)} for n in Z are divergent, except for an exceptional set of integers n satisfying

 #{n in S|-X<=n<X}=o(X).
(12)

3. The number of cycles is finite.

4. If the trajectory {T^K(n)} for n in Z is not eventually cyclic, then the iterates are uniformly distribution mod d^alpha for each alpha>=1, with

 lim_(N->infty)1/(N+1)card{K<=N|T^K(n)=j (mod d^alpha)} 
 =d^(-alpha)
(13)

for 0<=j<=d^alpha-1.

Matthews believes that the map

 T(x)={7x+3   for x=0 (mod 3); 1/3(7x+2)   for x=1 (mod 3); 1/3(x-2)   for x=2 (mod 3)
(14)

will either reach 0 (mod 3) or will enter one of the cycles (-1) or (-2,-4), and offers a $100 (Australian?) prize for a proof.

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.