Typically, Collatz (or the 3x+1 problem) only applies to integer values for x, but what about non-integer values? Does Collatz even make sense for non-integers? Find out below.
Initial observation:
The standard Collatz problem is as follows.
Starting from an integer x0, find the next value xi using the recurrence:
One common question is, how many steps does it take to get from an initial number x0 to 1? Also, of those steps, how many were 3x+1 steps (m), and how many were x/2 steps (d),
Previously, it has been shown that division-free Collatz gives the same results for the number of steps, m, and d. The division-free recurrence being,
with a new terminating condition of xi=2k for some integer k. Where lob(xi) is the value of the lowest order bit in the binary encoding of xi. In this formulation, the final value for xi will be 2d where d is the number of division steps in standard Collatz, and m is the number of times the division free recurrence was applied to get to 2d.
Question:
Can the rules of Collatz be extended to non-integers?
Derivation:
By expanding the non-lob terms of the recurrence gives:
By replacing the summation with y and setting i=m, we get the simpler expression:
Since the stopping condition is xi=2d, at which point i=m, the expression will be:
Unfortunately, this expression doesn’t have any information about d, which is needed to compute the total steps to 1. Recalling that the terminating condition is that xm=2d, we can replace xm with 2d, and add an additional 2d to both sides. With a bit of algebraic manipulation, z can be defined as follows, which can be used to recompute x0.
Setting aside how to compute y, solving this expression for x0 gives:
which curiously has a power of 3 in the denominator.
Defining w and V
In the expansion of the recurrence above, it is clear that the lob bits for each iteration are critical to this computation. Therefore it is helpful to keep track of the lob bits, by defining additional value w and vector V, which can be computed from x0 while applying the division-free recurrence. Let vi ∈ V be the position of the lowest order bit in xi, and w(x0) be the sum of the lowest order bits over the computations of division-free Collatz from x0 to 2d. Thus the relationship between w and V is,
As shown in the table below, the value of w, can be computed by summing over the lob(xi) each iteration. For x0=33 the sum of the lowest order bits is 281,397.
| Arithmetic Region (ARi) | ||||||||||||
| i | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | xi | vi | lob(xi) |
| 0 | 1 | 0 | 00 | 01 | 33 | 0 | 20 | |||||
| 1 | 11 | 0 | 01 | 00 | 100 | 2 | 22 | |||||
| 2 | 1 | 001 | 1 | 00 | 304 | 4 | 24 | |||||
| 3 | 1 | 1 | 101 | 0 | 928 | 5 | 25 | |||||
| 4 | 1 | 01 | 1 | 000 | 2816 | 8 | 28 | |||||
| 5 | 100 | 01 | 0 | 8704 | 9 | 29 | ||||||
| 6 | 1 | 101 | 00 | 26624 | 11 | 211 | ||||||
| 7 | 101 | 000 | 81920 | 14 | 214 | |||||||
| 8 | 1 | 0000 | 262144 | 18 | 218 | |||||||
| w | 1 | 0001 | 001 | 01 | 1 | 001 | 1 | 01 | 01 | 281397 |
Computing m, and d from w and V
Since w and V are so closely related, how they define m and d are similarly related. The length of V is also the number of one bits in w, which is the value of m. Similarly, d is the last element of V (also log2 hob(xi)).
Computing z from V
To get z from V is the summation:
Recalling that w can be defined as a sum, there is a simple method to convert the bits in w to z, but getting w back from z is more complicated. This complication comes from the lack of predictability of lob(xi).
Enumeration:
Since z, m, and d are easily computed from V or w, we can rewrite the equation for x0 as
But what happens when an arbitrary value is used for w (i.e., not just a w computed from an integer x0)? The equivalent V has a length, which is m, and the final and largest value in V is d.
Since x0 (along with m and d) can be computed from z, and z can be easily computed from a V vector, then by enumerating possible values of w and therefore valid z values, should also enumerate possible values of x0 that includes non-integers.
The first graph below is m+d (i.e., steps to 1 in standard Collatz) versus the resulting x0. The integer values of x0 are shown with blue ‘x’s, while orange dots are non-integer x0 values computed directly from other w values. The second graph shows the same values over a wider range of x0 values. The code to generate these graphs is available on github.

Number of steps to 1 for x0 from 1 to 25 Integer x0 values shown with blue ‘x’s

Number of steps to 1 for x0 values 1 to 5000, and w values from 1 to 100,000.
The next graph shows the relationship between x0 and w. The final graph shows the same values over a wider range of x0 and w values.

Plot of w vs x0 for small values of x0 and w.

Plot of w vs x0 sampled over wider range of w and x0 values
Conclusion:
Through some algebraic manipulation and the definition of some new variables, yes it is possible to extend a form of Collatz to certain non-integer values and compute the number of steps it would take to to reach 1 for those non-integers.
Future Questions:
Now that some non-integers have been found where the number of steps to 1 can be computed, are there any other forms of non-integers that also work?
Pingback: Extending Collatz to Non-Integers Part 2 | Doing Science To Stuff
Pingback: The Curious Case of 3^41 | Doing Science To Stuff