

A263716


Numbers in the Collatz conjecture in the order of their first appearance.


1



1, 2, 3, 10, 5, 16, 8, 4, 6, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 9, 28, 14, 12, 15, 46, 23, 70, 35, 106, 53, 160, 80, 18, 19, 58, 29, 88, 44, 21, 64, 32, 24, 25, 76, 38, 27, 82, 41, 124, 62, 31, 94, 47, 142, 71, 214, 107, 322, 161, 484, 242, 121, 364, 182
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,2


COMMENTS

This is the irregular triangle read by rows giving trajectory of n in the Collatz problem, flattened and with all the repeated terms deleted.
This sequence goes to infinity as n gets larger. On the Collatz conjecture this sequence is a permutation of the positive integers. [Corrected by Charles R Greathouse IV, Jul 29 2016]


LINKS

Daniel Suteu, Table of n, a(n) for n = 0..19999


FORMULA

a(n) = {
if seen[n]: stop
else: write(n) and do:
 n is one: stop
 n is odd: n < 3*n+1
 n is even: n < n/2
}


EXAMPLE

The Collatz trajectories for the first five positive integers are {1}, {2, 1}, {3, 10, 5, 16, 8, 4, 2, 1}, {4, 2, 1}, {5, 16, 8, 4, 2, 1}.
From {2, 1} we delete 1 because it has already occurred. From {3, 10, 5, ..., 4, 2, 1} we delete {2, 1} because both numbers have already occurred. We completely get rid of {4, 2, 1} because it has already occurred as the tail end of {3, 10, 5, ...}, and we also completely get rid of {5, 16, 8, ...} for the same reason.
This leaves us with {1}, {2}, {3, 10, 5, 16, 8, 4}, thus accounting for the first eight terms of this sequence.


MATHEMATICA

collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; DeleteDuplicates[Flatten[Table[collatz[n], {n, 20}]]] (* Alonso del Arte, Oct 24 2015 *)


PROG

(Sidef)
func collatz(n) is cached { # automatically memoized function
say n; # prints the first unseen numbers
n.is_one ? 0
: (n.is_even ? collatz(n/2)
: collatz(3*n + 1));
}
range(1, Math.inf).each { i collatz(i) }


CROSSREFS

Cf. A070165.
Sequence in context: A139693 A182076 A266552 * A175899 A328613 A064946
Adjacent sequences: A263713 A263714 A263715 * A263717 A263718 A263719


KEYWORD

nonn,easy,nice


AUTHOR

Daniel Suteu, Oct 24 2015


STATUS

approved



