OFFSET
1,3
COMMENTS
T is the map T(x) = x/2 (x even) and T(x) = (3x+1)/2 (x odd) and T^(k)(x) = T^(k-1)(T(x)). This sequence has some arithmetical structures and fractal structures. For instance multiples of 3 are not in the sequence.
This is floor(log(n)/log(2)) iterations of the Collatz function applied to n. - T. D. Noe, Sep 25 2012
LINKS
T. D. Noe, Table of n, a(n) for n = 1..10000
FORMULA
Special values: a(2^k)=1, a(2^k-1)=2*3^(k-1)-1, a(4^k+1)=3^k+1, a(2*4^k+1)=3^(k+1)+2,...
MATHEMATICA
T[n_] := If[EvenQ[n], n/2, (3 n + 1)/2]; Table[Nest[T, n, Floor[FullSimplify[Log[n]/Log[2]]]], {n, 100}] (* T. D. Noe, Sep 25 2012 *)
PROG
(PARI) T(x)=if(x%2, (3*x+1)/2, x/2);
p(m, n)=if(n<0, 0, t=0; s=n; while(t<m, s=T(s); t++); s);
a(n)=p(floor(log(n)/log(2)), n)
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Sep 17 2012
STATUS
approved