testitemqlstudop wrote:
f(x) = n*p+k otherwise
Typo: I think you mean f(x) = n*x+k.
I'm not entirely sure what you're asking here. I guess you could think of this as an infinite state 0D CA, though that's not very interesting from a CA standpoint.
You may also be asking how to implement it as a 1D CA. This may help illustrate why the problem is harder than it looks. Essentially it is applying a rule to a potentially infinite memory, as a CA or Turing machine would do, only the infinite memory is represented as a single integer value, lending the question its deceptive simplicity.
Let's stick with the original
3n+1 form of the problem.
If the number is encoded as bits, you test if the rightmost bit is 0 or not and remove it if it is, shortening the string. Otherwise, you multiply by 3, which is like adding the value to itself with one left shift and then add 1, which is like flipping each 1 to 0 until you get to the rightmost 0, which you change to 1.
Adding a number to itself shifted one bit can be implemented easily with a finite state machine going right to left. It's not too hard to see how to embed this operation in a CA like framework (but CAs are Turing complete, so no surprise there).
Two thoughts. Looking at the Collatz conjecture in terms of bit strings is at least useful in developing intuition for why it is hard, though it doesn't prove anything. Conceivably, it would give you a better analytical framework for attacking it, though I don't see how.
Finally, (since you requested opinions) I'm not sure generalizing it is that enlightening given that it looks nearly intractable in its simplest form.
Hmm, there is one thought I had. If you known that the current value of x contains a specific bit substring, e.g.1001, then you can say something about what it will look like in the next step. The hard cases is when you need to calculate 3n+1. The first question is whether the carry propagates from the suffix to the right. The second question is whether the carry propagates when adding 1. So I think representing it as a bit string could help analyze cases.
Starting at 27 looks like this in binary:
Code: Select all
11011
1010010
101001
1111100
111110
11111
1011110
101111
10001110
1000111
11010110
1101011
101000010
10100001
111100100
11110010
1111001
101101100
10110110
1011011
100010010
10001001
110011100
11001110
1100111
100110110
10011011
111010010
11101001
1010111100
101011110
10101111
1000001110
100000111
1100010110
110001011
10010100010
1001010001
11011110100
1101111010
110111101
10100111000
1010011100
101001110
10100111
111110110
11111011
1011110010
101111001
10001101100
1000110110
100011011
1101010010
110101001
10011111100
1001111110
100111111
1110111110
111011111
10110011110
1011001111
100001101110
10000110111
110010100110
11001010011
1001011111010
100101111101
1110001111000
111000111100
11100011110
1110001111
101010101110
10101010111
1000000000110
100000000011
1100000001010
110000000101
10010000010000
1001000001000
100100000100
10010000010
1001000001
11011000100
1101100010
110110001
10100010100
1010001010
101000101
1111010000
111101000
11110100
1111010
111101
10111000
1011100
101110
10111
1000110
100011
1101010
110101
10100000
1010000
101000
10100
1010
101
10000
1000
100
10
1
How about ternary representation? Then 3n is trivial, but testing even/odd is harder.