A359207 Number of steps to reach 0 starting with n in the map x->A359194(x) (binary complement of 3n), or -1 if 0 is never reached.
0, 1, 2, 11, 12, 1, 10, 3, 4, 13, 2, 19, 80, 9, 2, 15, 16, 81, 14, 11, 12, 1, 6, 83, 8, 73, 22, 79, 7572, 5, 18, 75, 76, 7573, 74, 7, 12, 17, 10, 3, 4, 13, 2, 7571, 4, 85, 78, 15, 96, 21, 5498, 91, 72, 13, 6, 7, 56, 13, 82, 3, 20, 5, 98, 15, 16, 21, 14, 7
Offset: 0
Examples
a(7) = 3 because it takes 3 steps to reach 0: (7, 10, 1, 0).
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..10000
- Tim Peters, Seeds under 2*10^6 that take more than 10^8 steps to reach 0
- Tim Peters, Seeds under 10^7 that take more than 10^9 steps to reach 0
- Joshua Searle, Collatz-inspired sequences.
Programs
-
Mathematica
f[n_] := FromDigits[BitXor[1, IntegerDigits[3*n, 2]], 2]; Array[-1 + Length@ NestWhileList[f, #, # != 0 &] &, 68, 0] (* Michael De Vlieger, Dec 21 2022, faster function by Hans Havermann *)
-
PARI
f(n) = if(n, bitneg(n, exponent(n)+1), 1); \\ A035327 a(n) = my(nb=0, m=n); while (m, m=f(3*m); nb++); nb; \\ Michel Marcus, Dec 21 2022
-
Python
def f(n): return 1 if n == 0 else (m:=3*n)^((1 << m.bit_length())-1) def a(n): i, fi = 0, n while fi != 0: i, fi = i+1, f(fi) return i print([a(n) for n in range(68)]) # Michael S. Branicky, Dec 20 2022
Comments