|
|
A304030
|
|
a(n) is the number of steps at which the Collatz ('3x+1') trajectory of n crosses its initial value, or -1 if the number of crossings is infinite.
|
|
4
|
|
|
0, 0, 1, 0, 1, 4, 3, 0, 5, 2, 3, 2, 3, 8, 3, 0, 3, 10, 7, 0, 1, 6, 1, 0, 9, 2, 3, 6, 7, 4, 3, 0, 13, 4, 1, 4, 5, 8, 9, 0, 7, 2, 5, 2, 3, 4, 5, 0, 5, 8, 5, 0, 1, 14, 9, 0, 7, 2, 3, 6, 7, 12, 9, 0, 5, 6, 3, 0, 1, 4, 7, 0, 13, 2, 1, 2, 3, 8, 3, 0, 7, 14, 11, 0, 1, 8, 3, 0, 3, 2, 7, 4, 5, 12, 9, 0, 19, 4, 1, 0
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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)
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|