login
One of the basic cycles in the x->3x-1 (x odd) or x/2 (x even) problem.
3

%I #21 Oct 20 2023 22:42:22

%S 17,50,25,74,37,110,55,164,82,41,122,61,182,91,272,136,68,34,17,50,25,

%T 74,37,110,55,164,82,41,122,61,182,91,272,136,68,34,17,50,25,74,37,

%U 110,55,164,82,41,122,61,182,91,272,136,68,34

%N One of the basic cycles in the x->3x-1 (x odd) or x/2 (x even) problem.

%D Richard K. Guy, Unsolved Problems in Number Theory, E16.

%D H.-O. Peitgen et al., Chaos and Fractals, Springer, p. 33.

%e 17 is odd, so the next term is 3 * 17 - 1 = 50.

%e 50 is even, so the next term is 50/2 = 25.

%t Abs[NestList[If[EvenQ[#], #/2, 3# + 1]&, -17, 100]] (* _Alonso del Arte_, May 19 2015 *)

%o (PARI) a=34;A003124=vector(100,i,a=if(bittest(a,0),3*a-1,a/2)) \\ _M. F. Hasler_, Aug 29 2015

%o (PARI) A003124(n,a=17)={for(i=1,n%17,a=if(bittest(a,0),3*a-1,a\2));a} \\ _M. F. Hasler_, Aug 29 2015

%K nonn,easy

%O 0,1

%A _N. J. A. Sloane_