We can search for loops by deriving a single equation that combines a number of iterations, f(x), and then solve it for being equal to the original number: f(x) = x. For the unmodified sequence this is tricky as the equation has an 'if' condition in it, but if we just focus on the odd sequence it becomes easier.

The next-odd iterator maps x→(3x+1)/2^{a1}, where 'a1' is a integer (>0).

If we can find an odd integer solution to (3x+1)/2^{a1} = x we will have
a loop that contains a single odd number and 'a1' even ones. This expression rearranges to
(2^{a1}−3)x = 1.
The only positive integer factorisation of 1 is 1 x 1, so both
x and (2^{a1} − 3) must be 1. The second condition leads
to a1 = 2. The corresponding loop is [1,4,2,1]. This is the only possible loop with one odd member.

If we relax the positive integer requirement we get a second solution where a1 = 1 and x = −1. This is a loop with one odd and one even member [-1,-2,-1].

For 2−cycles the equation to solve is f(x) = (9x + 2^{a1} + 3) / 2^{(a1+a2)}
= x (where 'a_{1}' and 'a_{2}' are integers greater than 0).

This can be rearranged to (2^{(a1+a2)}−9)x = (2^{a1}+3),
so we need to find integral values of (2^{a1}+3) which are multiples of (2^{(a1+a2)}−9).
The following table contains the calculations for some small values of a1 and a2 and shows that there are 4 solutions.

a1 | a2 | 2^{a1}+3 | 2^{(a1+a2)}−9 | x |

1 | 1 | 5 | −5 | −1 |

1 | 2 | 5 | −1 | −5 |

1 | 3 | 5 | 7 | 5/7 |

2 | 1 | 7 | −1 | −7 |

2 | 2 | 7 | 7 | 1 |

2 | 3 | 7 | 23 | 7/23 |

3 | 1 | 11 | 7 | 11/7 |

3 | 2 | 11 | 23 | 11/23 |

4 | 1 | 19 | 23 | 19/23 |

Two of these solutions (−1 and 1) are repeats of the solutions for 1−cycles, leaving only −5 and −7, which are two halves of the same solution, [−5, −14, −7, −20, −10, −5]. This cycle contains 3 even numbers as a1+a2 = 3.

There are no solutions for larger 'a' values as the potential values of x are already less then one, and become even smaller as the 'a' values increase.

As we move to larger cycles we will always see that setting all the 'a' values to 1 will lead to x = −1 and setting them all to 2 will produce x = 1.

For larger cycles we can calculate a series of equtions of the form K⋅x = S, where:

K = 2^{a1+a2+...+an} - 3^{n}

S = 3^{n-1} + 3^{n-2}*2^{a1} + 3^{n-3}*2^{a1+a2} +
... + 2^{a1+a2+...+a(n-1)}

The 'a' values are the number of even numbers between successive odd values in the loop. We can define 'm' as the number of even values in the loop, giving

m = a1 + a2 + ... + an

K = 2^{m} - 3^{n}

We can do a quick search for solutions when n is 3 by constructing a table similar to the one we wrote for n = 2 in the previous section. This table, even for small a values is quite long, so I've reproduced it on a separate page for 'a' values up to m = 8. The only integer solutions are the ones we've found already, −1 and 1.

For positive solutions we can reject values where K is negative, which shows that any loops will always have more even values than odd ones, in fact m > (log(3) ∕ log(2))n. Log(3) ∕ log(2) is just under 1.585, so there will be at least 58% more even values than odd one.

First, let us define A_{1} as the set [a_{1},a_{2},...,a_{n}], A_{2}
as [a_{2},...,a_{n},a_{1}],
A_{3} as [a_{3},...,a_{n},a_{1},a_{2}], etc. (A_{i+1}
is obtained by rotating the values in A_{i} one place to the left). The set
[A_{1}, A_{2}, ...]
has n members, as A_{n+1} is the same as A_{1}.

We can then define the set [s_{1}, s_{2}, ...] =
[S(A_{1}), S(A_{2}), ...]
as the values obtained
by inserting the sets [A_{1},...,A_{n}] into the numerator of the equation for 'x'.

S(A) = 3^{n-1} + 3^{n-2}⋅2^{a1} + 3^{n-3}⋅2^{a1+a2}
+ ... + 2^{a1+a2+...+a(n-1)}

We can now see that s_{2} = (3⋅s_{1} + K) ∕ 2^{a1},

s_{1} =
3^{n-1} + 3^{n-2}⋅2^{a1} + 3^{n-3}⋅2^{a1+a2} +
... + 2^{a1+a2+...+a(n-1)}

3s_{1} =
3^{n} + 3^{n-1}⋅2^{a1} + 3^{n-2}⋅2^{a1+a2} +
... + 3⋅2^{a1+a2+...+a(n-1)}

3s_{1}+K =
3^{n-1}⋅2^{a1} + 3^{n-2}⋅2^{a1+a2} +
... + 3⋅2^{a1+a2+...+a(n-1)} + 2^{a1+a2+...+an}

= 2^{a1}⋅(3^{n-1} + 3^{n-2}⋅2^{a2} +
... + 3⋅2^{a2+...+a(n-1)} + 2^{a2+...+an})

= 2^{a1}⋅s_{2}

so the set [s_{1}, s_{2}, ...]
represents an n−cycle in x→3x+K.

Clearly all systems of the form
x→3x + (2^{m} − 3^{n})
will have cycles, with 'n' odd and 'm' even values.
For all cases other than n = 1, m = 2 there will be
multiple loops. For m=2, n=1 the only viable set A is [[2]] and there is only one loop.

The set of 'K' values seems rather sparse, but all systems 3x+k must have at least one loop (unless every seed diverges to infinity), so where do these come from?

If we start with the assumption that there is an s value, say s_{1}, that has a common
factor f with K, then we can define t_{1} = s_{1} ∕ f and
k = K ∕ f.
Then, s_{2} = 3⋅s_{1} + K = 3(f⋅t_{1}) + (f⋅k),
which is also a multiple of f, so, if s_{2} = f⋅t_{2} then
t_{2} = 3⋅t_{1}+k and the set [t_{1}, t_{2}, ...] forms
a cycle in 3x+k.

How can we use this to identify the loops in k = 11? We could look for K values that have 11 as a factor, then search the corresponding s values looking for one that has K ∕ 11 as a factor, or we could construct the tree for 3x+11 and see where the loops are.

The second approach sounds easier. Starting with 1, we immediately find the 2−cycle [1,7],
as 3⋅1 + 11 = 14 = 7⋅2 and
3⋅7 + 11 = 32 = 1⋅32. Here A = [1,5], so m=6 and n=2, giving
K = 2^{6}−3^{2} = 55 = 5⋅11.

s_{1} = 3^{1} + 2^{1} = 5

s_{2} = 3^{1} + 2^{5} = 35

So the loop [1,7] in 3x+11 corresponds to [5,35] in 3x+55.

There is also a 1−cycle, [11] in 3x+11, which in hindsight is rather obvious,
as (3k+k) ∕ 2^{2} always equals k.
This loop can be derived using multiplication from the 1−cycle in 3x+1. If
[s_{1}, s_{2}, ..., s_{n}] forms a n−cycle in
x→3x+K, then
[s_{1}⋅f, s_{2}⋅f, ..., s_{n}⋅f] forms a n−cycle in
x→3x+K⋅f.

Interestingly, in 3x+11 there is a third loop [13, 25, 43, 35, 29, 49, 79, 31].
Here A = [1, 1, 2, 2, 1, 1, 3, 3], so m=14, n=8 and
K = 2^{14}−3^{8} = 9823 = 893⋅11. If there are any other cycles
in 3x+11 they will involve very big numbers, I've searched up to 10 million.

Generally to find cycles in 3x+11 we need to find m and n values where
2^{m}−3^{n} is a multiple of 11. If we look at 2^{m}
modulo 11 we get the sequence [2, 4, 8, 5, 10, 9, 7, 3, 6, 1] and for 3^{n}
[3, 9, 5, 4, 1]. To find a solution we need to match pairs of numbers, one from each
set, m being the position in the first set and n that in the second. The 3 in position
8 in the first set matches the three in position 1 in the second, giving (m,n) = (8,1).
The full list is

2^{8}-3^{1} = 256-3 = 253 = 11⋅23

2^{6}-3^{2} = 64-9 = 55 = 11⋅5

2^{4}-3^{3} = 16-27 = -11 = 11⋅(-1)

2^{2}-3^{4} = 4-81 = -77 = 11⋅(-7)

2^{10}-3^{5} = 1024-243 = 781 = 11⋅71

Two of these, 2^{4}-3^{3} and 2^{2}-3^{4} are negative, but as the
remainders modulo 11 cycle for every 10 'm' we can just add 10 to the 'm' values giving

2^{10+4}-3^{3} = 16384−27 = 16357 = 11⋅1487

2^{10+2}-3^{4} = 4096−81 = 4015 = 11⋅365

The remainders for powers of 3 also form a 5 cycle, so the 5 examples we have found; (m,n) ∈ [(8,1), (6,2), (14,3), (12,4), (10,5)]. We can generate the full set by adding the increments (10i,5j) to any of the values in this basic set (i and j are integers ≥0).

Generally, for all primes, p, if K(m,n) is a multiple of p then so is
K(m+i(p−1),n+j(p−1)), where i and j can be any positive integer. This is because
2^{i(p−1)} mod p = 3^{j(p−1)} mod p = 1.
As
K(0,0) = 0, K(i(p−1),j(p−1)) is also a solution, so for every prime 'p' there is
an infinite set of K values with p as a factor.

In the example for k=11, the generic equation for p misses out half the solutions
as 3^{5j}%11 = 1 giving the set of solutions
K = 2^{m+10i}−3^{n+5j},
where (m,n) ∈ [(8,1), (6,2), (14,3), (12,4), (10,5)] and i,j are integers.

This factor analysis only applies to primes and our equations only work when k = 6i+1 or 6i+5. The first non-prime of this form is 25, the second 35. The remainder sets are

2^{i} mod 25 = [1, 2, 4, 8, 16, 7, 14, 3, 6, 12, 24, 23, 21, 17, 9, 18, 11, 22, 19, 13]

3^{i} mod 25 = [1, 3, 9, 2, 6, 18, 4, 12, 11, 8, 24, 22, 16, 23, 19, 7, 21, 13, 14, 17]

2^{i} mod 35 = [1, 2, 4, 8, 16, 32, 29, 23, 11, 22, 9, 18]

3^{i} mod 35 = [1, 3, 9, 27, 11, 33, 29, 17, 16, 13, 4, 12]

The important thing to note here is that although it is not so easy to predict how big the remainder sets are they still form a loop that includes 1, so there will always be an infinite set of answers.

There are at least 8 cycles in 3x+25, with seeds of [5,7,17,25,95,115,935,1735]. Six of these are multiples of cycles in 3x+5. The loop based on 7 has 8 members, [7, 23, 47, 83, 137, 109, 11, 29], A = [1, 1, 1, 1, 2, 5, 1, 4], m = 16, n = 8, K = 58975 = 25⋅2359.

There are at least 9 cycles in 3x+35, based on [7, 13, 17, 25, 35, 133, 161, 1309, 2429].
Of these, [7, 35, 133, 161, 1309] are multiples of cycles in 3x+5 and [25, 35] are multiples
of cycles in 3x+7. Therefore, 17 is the only novel loop. This is a 4−cycle where A = [1,2,1,4],
so K = 2^{8}−3^{4} = 175 (5⋅35).

121 is the first composite k value where non of the factors are multiples of a K value. This has 5 loops based on [5, 11, 19, 121, 143]. The loop sizes are [18, 2, 46, 1, 8] so they all come from different K's.

For the 19-cycle:

A = [1,2,2,1,1,1,1,3,1,5,2,1,1,2,3,1,1,1,2,1,2,1,2,3,1,1,2,3,2,2,1,2,2,2,3,3,3,1,2,1,2,5,1,1,1,6]

K = 2^{88} - 3^{46} = 309476146883225416223685127 = 121 × 2557654106472937324162687

I ran a systematic search for loops in other systems for k values up to 199 and seed values up to 100 million. You can see the results here. In this search all the loop seeds were relatively small compared to k, the largest ratio being 243.4 for s = 7055 and k = 29. The sequence of record holders is...

System | Seed | Size | Seed/K |

3x+1 | 1 | 1 | 1.0 |

3x+5 | 347 | 17 | 69.4 |

3x+29 | 7055 | 41 | 243.3 |

This would be an interesting search to continue, but it is rather expensive in computer time. The absense of medium size loop seeds in this search doesn't rule out their existance but it does suggest that loops become scarcer as the range of numbers searched gets higher.

A-Lists: Explores the lists of A-Values described above, the loops they generate and the constraints they place on the locations of additional loops in 3x+1.

3x+47: 47 is 128−81, so it should have some 4−cycles. It also has a 7 and 16 cycle. Click the link for an illustration.

Integer approximations to log(3) ∕ log(2): The best candidates for finding loops are when m ∕ n is close to log(3) ∕ log(2).

Constraints on loop size: More ramblings on loop size.

(c) John Whitehouse 2011 - 2017