OFFSET
0,3
COMMENTS
Similar to A128333 and related to the 3x+1 (Collatz) sequence. Hits all positive integers?
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..10000
EXAMPLE
a(1)=1 => a(2)=3*1+1=4 because a(1) is odd => a(3)=4/2=2 because a(2) is even => a(4)=3*2+0=6 because a(3) is even but a(3)/2 is already in the sequence.
MATHEMATICA
a[0] = 0; a[1] = 1; a[n_] := a[n] = With[{b = a[n-1]}, If[EvenQ[b] && FreeQ[Array[a, n, 0], b/2], b/2, 3 b + Mod[b, 2]]];
Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Jun 20 2019 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Alexis Monnerot-Dumaine, Jun 19 2019
STATUS
approved