Bill Allombert on Mon, 12 Feb 2024 11:26:55 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [Collatz] how to best derive x and T^n(x) from a parity vector


On Sun, Feb 11, 2024 at 09:05:58PM +0100, Ruud H.G. van Tol wrote:
> 
> An example parity vector is [1,1,0,1,1,0,0].
> 
> This represents: T^7(x) = (3^4 * x + 85) / 2^7.
> 
> __|__1___1___0_____1_____1_____0______0_
> x*| 3/2 9/4 9/8 27/16 81/32 81/64 81/128
> 0+| 1/2 5/4 5/8 23/16 85/32 85/64 85/128
> 
> 
> T(x) = { if(x%2, 3*x+1, x)/2 }
> 
> y = T^7(x) = (3^4 * x + 85) / 2^7.
> (and y <= x)
> 
> 81 * x + 85 = 128 * y <=>
> 81 * x = 128 * (y-1) + 43 <=>
> 81 * x % 128 = 43 (and x >= 43)
> 
> Because of how the parity vector is built,
> if its length is >= 4, then x = 3 (mod 4).
> 
> So we can try (43, 47, 51, 55, 59, ...) and find that x = 59 works:
> 
> (81 * 59 + 85) / 128 = 38

So you want to solve 

3^4 * x + 85 = 0 [mod 2^7] ?

You can do
? -Mod(85,2^7)/3^4
%1 = Mod(59,128)

Or even

? -85/81%128
%2 = 59

Cheers,
Bill