OFFSET
0,3
COMMENTS
It is unknown whether each positive starting integer eventually reaches 0.
From Jon E. Schoenfield, Dec 21 2022: (Start)
a(n) == n (mod 4).
a(n) = 1 iff 3*n + 1 = 4^k for some integer k. (End)
All but 10 values under 10^7 have been run to 0. Each of the remaining 10 requires over 2*10^12 steps. They're all in one group that reaches the same high value (nearly 8 million bits wide) after about 2*10^12 steps. The smallest value in this group is 3417582. - Tim Peters, Jun 14 2023
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..10000
Joshua Searle, Collatz-inspired sequences.
EXAMPLE
a(7) = 3 because it takes 3 steps to reach 0: (7, 10, 1, 0).
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 *)
PROG
(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
(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
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Joshua Searle, Dec 20 2022
STATUS
approved