A359255 Number of steps to reach a maximum starting with n in the map x->A359194(x) (binary complement of 3n), or -1 if n goes to infinity.
0, 0, 0, 7, 8, 0, 6, 1, 2, 9, 0, 15, 28, 5, 1, 11, 12, 29, 10, 7, 8, 0, 2, 31, 4, 21, 5, 27, 2962, 1, 14, 23, 24, 2963, 22, 3, 8, 13, 6, 0, 0, 9, 0, 2961, 2, 33, 26, 11, 74, 4, 1591, 69, 20, 5, 3, 3, 34, 9, 30, 1, 16, 1, 76, 11
Offset: 0
Links
- Hans Havermann, Table of n, a(n) for n = 0..10000
Programs
-
Mathematica
f[n_] := FromDigits[BitXor[1, IntegerDigits[3*n, 2]], 2]; Table[c=m=0; n=r=i; While[n!=0, c++; n=f[n]; If[n>r, m=c; r=n]]; m, {i, 0, 63}]
-
Python
def f(n): return 1 if n == 0 else (m:=3*n)^((1 << m.bit_length())-1) def a(n): i, fi, m, mi = 0, n, n, 0 while fi != 0: i, fi = i+1, f(fi) if fi > m: m, mi = fi, i return mi print([a(n) for n in range(64)]) # Michael S. Branicky, Dec 22 2022
Comments