OFFSET
1,6
COMMENTS
Some treatments of the Collatz conjecture view trajectories as starting to cycle when they reach 1, continuing with 4, 2, 1, 4, 2, 1, ..., while others view trajectories as terminating as soon as 1 is reached; this sequence treats trajectories as terminating at 1.
If the Collatz conjecture is true, then for n > 1, a(n) == n (mod 2).
If there exists any number n whose Collatz trajectory enters a cycle that includes values above and below n, then the number of crossings would be infinite. If the Collatz conjecture is true, then there exists no such value of n.
If a(k) = 0, then a(2^j * k) = 0, for j>0. Therefore the primitives are 1, 20, 24, 52, 56, 68, 72, 84, 88, 100, 116, ..., . - Robert G. Wilson v, May 19 2018
LINKS
EXAMPLE
The Collatz trajectory of 6 crosses its initial value (6) a total of 4 times, so a(6) = 4:
.
16
/ \
/ \
10 / \
/ \ / \
/ \ / 8
6---------*-----*---*-----------*--------
\ / \ / \
\ / 5 \
\ / \
\ / 4
3 \
...
(Each "*" represents a crossing.)
MATHEMATICA
Collatz[n_] := NestWhileList[ If[ OddQ@#, 3# +1, #/2] &, n, # > 1 &]; f[n_] := Block[{x = Length[ SplitBy[ Collatz@ n, # < n +1 &]] - 1}, If[ OddQ@ n && n > 1, x - 1, x]]; Array[f, 100] (* Robert G. Wilson v, May 05 2018 *)
PROG
(Python)
def A304030(n):
prevc = c = n
h = 0
while c > 1:
if c % 2:
c = 3*c+1
if prevc < n and c > n: h += 1
else:
c //= 2
if prevc > n and c < n: h += 1
prevc = c
return h
print([A304030(n) for n in range(1, 100)]) # Paolo Xausa, Feb 22 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Jon E. Schoenfield, May 04 2018
STATUS
approved