A273039 Numbers k such that the following process converges to zero: x(0)=k, x(i+1) = x(i) XOR ror(x(i)) XOR rol(x(i)); see the Comments section for details.
0, 5, 6, 9, 24, 29, 34, 40, 43, 45, 48, 51, 54, 57, 65, 66, 68, 71, 75, 77, 80, 83, 86, 89, 90, 92, 101, 102, 111, 129, 130, 135, 139, 141, 153, 154, 159, 180, 189, 198, 204, 209, 216, 219, 226, 231, 232, 238, 257, 260, 263, 267, 272, 275, 277, 278, 282, 284, 297
Offset: 1
Examples
n=5: x(0)=5, x(1) = 5 xor 6 xor 3 = 0. n=6: x(0)=6, x(1) = 6 xor 5 xor 3 = 0. n=9: x(0)=9, x(1) = 9 xor 12 xor 3 = 6, x(2)=0. n=10: x(0)=10, x(1) = 10 xor 5 xor 5 = 10, and x(i)=10 for i>1. n=17: x(0)=17, x(1) = 17 xor 24 xor 3 = 10, and x(i)=10 for i>1. So 5, 6, 9 are in the sequence, 10 and 17 are not.
Programs
-
Mathematica
Select[Range[0, 300], Nest[BitXor[BitXor[#, FromDigits[ RotateRight[ IntegerDigits[#, 2]], 2]], FromDigits[ RotateLeft[ IntegerDigits[#, 2]], 2]] &, #, 120] == 0 &] (* Michael De Vlieger, May 14 2016 *)
-
Python
def ROR(n): # returns A038572(n) BL = len(bin(n))-2 return (n>>1) + ((n&1) << (BL-1)) def ROL(n): # returns A006257(n) BL = len(bin(n))-2 return (n*2) - (1<
Comments