My hunt for a Collatz cycle

28 Mar 2026

The Collatz conjecture is a famous and infamous conjecture regarding the sequence generated by:

f(n)={n2,if n0mod23n+1,otherwisef(n) = \begin{cases} \frac{n}{2},& \text{if } n &\equiv 0 \mod{2}\\ 3 * n +1, & \text{otherwise} \end{cases}

The conjecture states that for all positive integer values of nn, the sequence will always end in the trivial 14211-4-2-1 cycle. As example, the sequence for f(3)f(3) is:

31051684213 → 10 → 5 → 16 → 8 → 4 → 2 → 1

All tested values up to 2712^{71} end with this cycle. But so far it is unknown if there are any non-trivial cycles and if some value of nn flies off to infinity.

When starting this, I nurtured no expectations of doing anything meaningful. But I played around with math, got a better understanding of the conjecture, some of the related problems and learned something new.

Generalizing Collatz sequences

Instead of finding cycles for the classic Collatz conjecture, one can abstract a bit to find cycles in the Collatz-like sequences generated by:

f(n)={n2,if n0mod2qn+1,otherwisef(n) = \begin{cases} \frac{n}{2},& \text{if } n &\equiv 0 \mod{2}\\ q * n +1, & \text{otherwise} \end{cases}

Where qq is an odd number greater than or equal to 33. For q=3q=3, we have the normal Collatz sequence.
For q=5q=5, at least two cycles are known: n=13n = 13 and n=17n = 17.

The addend can also be generalized to get:

f(n)={n2,if n0mod2qn+a,otherwisef(n) = \begin{cases} \frac{n}{2},& \text{if } n &\equiv 0 \mod{2}\\ q * n +a, & \text{otherwise} \end{cases}

Where qq and aa are odd integers, q3q \geq 3, a1a \geq 1.

This generalization makes cycles even more common. Two examples:

Here is a calculator to play around with cycles:

Algebraic form

Despite Collatz sequences being defined recursively, it’s easy to write a sequence out using common algebra. The cycle generated with 5n+75n+7, for n=7n=7 can be written out as:

g(n)=n5+725+72222=25n+4932g(n) = \frac{\frac{\frac{\frac{\frac{n*5+7}{2}*5+7}{2}}{2}}{2}}{2} = \frac{25n + 49}{32}

Using n=7n=7 gives:

g(7)=257+4932=7g(7) = \frac{25*7+49}{32} = 7

And thus we have a non-trivial cycle that takes 22 steps up and 55 steps down.

Writing out any Collatz-like sequence will provide a function of the form:

g(n)=qun+k2dg(n) = \frac{q^u*n+k}{2^d}

uu is the number of steps up that the sequence takes, and dd is the number of steps down.
The value of kk is determined by the actual steps in the sequence and the addend, aa.

For any cycles to happen, we must have the case that

g(n)=qun+k2d=ng(n) = \frac{q^u*n+k}{2^d} = n

This formula is interesting because it gives a relationship between ups and downs a sequence has, and the value of nn:

g(n)=qun+k2d=ng(n) = \frac{q^u*n+k}{2^d} = n

Solving for nn:

n=k2dqun = \frac{k}{2^d - q^u}

Again, considering 5n+75n+7, n=7n=7 and k=49k=49 from before, this is:

n=492552=497=7n = \frac{49}{2⁵-5²} = \frac{49}{7} = 7

A different number in the cycle is 2121, for which k=147k=147:

n=1477=21n = \frac{147}{7} = 21

Consider the fact that 252^5 isn’t much greater than 525^2, indeed it is only bigger by 77.
Speaking purely from a divisibility standpoint, it’s not hard to find integers divisible by 77. So it makes sense to look for qq values near roots of powers of 22 as that will produce a small difference with the closest, smaller, odd power.

The number 21518122^{15} \approx 181^2. Indeed, 2151812=72^{15}-181^2 = 7. It so happens that q=181q=181 generates two 1717-step cycles:

Making the same observation for q=5q=5: 27532^7 \approx 5^3. 2753=32^7 - 5^3 = 3, and this time resulting in a 7+3=107+3 = 10 cycle.
Again, it’s easy to find numbers divisible by 33, and so the set of possible kk’s is big. Looking for qq-values near roots of 22 definitely makes sense.

Ramanujan–Nagell

At this point, I came across the Ramanujan–Nagell equation, which asks to find solutions for:

2n7=x22^n–7 = x^2

And states that the only solutions are:

x,n=(1,3),(3,4),(5,5),(11,7),(181,15)x, n = (1, 3), (3, 4), (5, 5), (11, 7), (181, 15)

For Ramanujan-Nagell, it is only for 77 that we will have four solutions. All other positive integers beside 77 will have at most two solutions. In general, according to Wikipedia, equations of my form will always have a finite number of solutions. This is a shame, because it would have been a very convenient shortcut to finding probable cycles by simply finding more cases where k=7k = 7.

Expanding on the algebraic form

For now, cycles will not be the focus. I will instead explore the algebraic form more.
Recall that algebraic form is just writing out the steps done for some nn.
For some qq and aa, a sequence could be generated by:

nq+a2q+a2q+a222222222\frac{\frac{\frac{\frac{\frac{\frac{\frac{\frac{\frac{\frac{\frac{n*q+a}{2}*q+a}{2}*q+a}{2}}{2}}{2}}{2}}{2}}{2}}{2}}{2}}{2}

Expanding gives:

4a+2aq+aq2+nq34*a + 2*a*q + a*q^2 + n*q^3

An alternative notation could be: UDUDUDDDDDDDD, denoting Up or Down.
Since I started with an odd number, the sequence must start with an up step. As the number will now be even, the second step must be down. The next step up, however, did not have to happen right away, it could also have happened later.

Some observations:

Cycles with aa > 1

In the previous section, I deduced a general form that takes different qq values and different aa values into account. Here is a sequence where I have set a=7a=7:

g(n)=n5+725+72222g(n) = \frac{\frac{\frac{\frac{\frac{n*5+7}{2}*5+7}{2}}{2}}{2}}{2}

For n=7n = 7, this will cycle, as previously noted.

g(7)=257+4932=7g(7) = \frac{25*7 + 49}{32} = 7

In this example, we have k=49k = 49, and kk will always be divisible by the addend, 77. Remember to get a cycle, it must be that:

n=k2dqun = \frac{k}{2^d-q^u}

Here one can actually simplify quite a bit and make it more probable to get a cycle by picking a value of aa such that gcd(a,(2dqu))>1gcd(a, (2^d-q^u)) > 1. We can even pick a=(2dqu)a = (2^d-q^u) and that makes it much easier to find any cycles. This is exactly what happened with 2552=72^5 - 5^2 = 7, where I picked a=7a = 7.

Here is a setup for more, less trivial cycles:

q=19a=217194=751q = 19 \\ a = 2^{17} - 19^4 = 751

This combination will produce cycles for e.g. n=7721n = 7721, n=7913n = 7913 and many more. 751751 is a prime number, so unsurprisingly, values of a<751a < 751 do not produce cycles.

Another combination is:

q=521456=759=31123q = 5 \\ 2^{14} - 5^6 = 759 = 3 * 11 * 23

Pick a value of aa such that gcd(759,a)>1gcd(759, a) > 1. I will pick a=323=69a = 3 * 23 = 69 and am quickly able to find cycles for n=1053n = 1053 and n=1147n = 1147.

Using this technique, I found these impressive looking 83-cycles:

q=49667a=13734584404743437q = 49667 \\ a = 13734584404743437

nn:

This was produced by 278496675=137345844047434372^{78} - 49667^5 = 13734584404743437

Finding cycles for 3n + a

There is a different generalization of the Collatz sequence that asks to find cycles generated by 3n+a3n + a, where gcd(a,3)=1gcd(a, 3) = 1 and gcd(a,2)=1gcd(a, 2) = 1. Let me first try for a=59a = 59. That means solving:

2d3u=59c2^d - 3^u = 59c

A solution to this is d=10d = 10, u=6u = 6 and c=5c = 5, giving 21036=2952^{10} - 3^6 = 295.
With this knowledge, I find the following nn values generating cycles:

Cycles when addend is 1

I now cycle back to the original problem after having explored variations of Collatz sequences.
After having run a good deal of brute forcing and finding numerous cycles with addend > 1, I have yet to find any examples, aside from q=5q = 5 and q=181q = 181, where a=1a = 1.
That’s annoying. But it also leads to possibly the most interesting graph in this post. Below is a plot of 2d2^d on the x-axis, and log10(2dqu)log_{10}(2^d - q^u) on the y-axis for the biggest odd, perfect power less than 2d2^d, plotted for each power in different colours.
There is an obvious trend that 2nd roots are closer to 2d2^d than 3rd roots, 3rd roots are closer than 4th roots, and so on. Since the y-axis has logarithmic values, the difference between 2d2^d and quq^u looks to be exponentially increasing.

Thoughts on the Collatz conjecture

Coming from the angle of what I did so far, I have been brute-forcing for values of uu and dd such that the binomial coefficient is high compared to the difference between the power of 2 and nearest, odd, perfect power:

(du1)2d3u\frac{\binom{d}{u-1}}{2^d - 3^u}

Is high.

The binomial coefficient increases polynomially. Unfortunately, it looks like the denominator in above equation grows exponentially.
In the plot below, for any 2d2^d, I picked the closest, smaller power of three. E.g., for 210=10242^{10} = 1024, I used 36=7293^6 = 729 since that would minimize the difference between the terms. On the y-axis is the log 10 of the difference between the powers:

One can see some outliers from the general trend. For example, at x=149x = 149, where log3(2149)=94.0085log_3(2^{149}) = 94.0085. Numerically that’s pretty close, but working with exponentials, 21493942^{149} - 3^{94} amounts to a very big difference, roughly 6.65910426.659 * 10^{42}.
(149941)4.631041\binom{149}{94-1} \approx 4.63*10^{41} and so the relevant binomial is still very small in comparison.

If, somewhere far out there, there is a case where 2a3b2^a \approx 3^b, that would be a good option to try out.

I have found thousands of cycles in Collatz-like sequences, including the form 3n+a3n+a with a>1a > 1, which is not that different from 3n+13n+1, on the surface. At first glance, 3n+53n+5 (with n=19n = 19) produces a cycle, then why would such one not exist for 3n+13n+1? Allowing negative addends, the 3n13n-1 sequence with n=17n = 17 produces a cycle as well.

On the other hand, for relevant qq, dd, and uu’s, I only know of two examples such that gcd(a,2dqu)=1gcd(a, 2^d - q^u) = 1, where aa is indeed 11. This would speak against that, and I have looked a lot.
Looking at the graph where the differences for bigger roots tended to be greater than square roots also speaks for the conjecture. If the multiplier, qq, is 33, it would have to be an enormously big root in play, and judging from the indications of the plots presented, that will give a very big difference and we will never have 2d3u2^d \approx 3^u.

I lean towards the conjecture being true. Maybe we’ll know some day.
Anyways, I have been playing around with this problem for a while now and learned something, so project well done. I will be putting down the Collatz conjecture for now.