[math-fun] Reverse then Add in base -1+i
I've been playing with the "reverse then add" algorithm for complex bases. I did it like this: 1. Begin with a decimal number, xd. 2. Convert xd to a binary string, x$. 3. Convert x$ to a complex number, xc, using the base -1+i (which can be used to represent all Gaussian integers, without needing a sign bit). 4. Reverse x$ to form y$. 5. Convert y$ to a complex number, yc, using the base -1+i. 6. Add xc and yc to form zc. 7. Convert zc to a binary string z$ (this is where I needed help). 8. z$ becomes the new x$. Repeat from step 3 until x$ is a palindrome. The first number that seems to not lead to a palindrome (within a few thousand steps) is 6 decimal, 110 binary, or -1-i. Here are the first 10 iterations: i complex binary decimal 0 -1-i 110 6 1 -1 11101 29 2 -5-i 10110 22 3 -2-i 11101011 235 4 -14-2i 1110100111000 7480 5 -26+5i 1110001101111 7279 6 -82+20i 1100100110101100 51628 7 -78-83i 1110011000111111 58943 8 -170-144i 1100110101111011100 420828 9 -98-139i 1000110010101111 36015 10 -209-239i 1111101001000000010 512514 Decimal 20 (binary 10110, complex -4-2i) also seems to not lead quickly to a palindrome. Its first 10 iterations are: i complex binary decimal 0 -4-2i 10100 20 1 -3-4i 11100001 225 2 -11-13i 11111011010 2010 3 -37+4i 1111110111101 8125 4 -107-23i 1111101110011110 64414 5 -69+74i 111010001110001001 238473 6 -329+441i 110011110000010000010 1695874 7 239+886i 10100101110110101001 679337 8 972+1560i 1110100101000001111001010000 244588112 9 -208-1889i 111010111010100100100000111 123554055 10 -396-6658i 111101010011100000011010100 128565460 If any of this is of interest, I'll submit relevant sequences (e.g., iteration counts or trajectories) to the OEIS. Kerry -- lkmitch@gmail.com www.kerrymitchellart.com
participants (1)
-
Kerry Mitchell