OFFSET
0,2
COMMENTS
On the set of positive integers, the orbit of any number seems to end in the orbit of 1, of 5 or of 17. Writing n=1+q*2^p with q odd, it is easily seen that for p=0,1 and p>3, some iterations of the map lead to a strictly smaller number (for n>17). The cases p=2 and p=3 may give rise to bigger loops (depending on the form of q). See sequences A135727-A135729 for maxima of the orbits and corresponding record indices. - M. F. Hasler, Nov 29 2007
REFERENCES
R. K. Guy, Unsolved Problems in Number Theory, E16.
LINKS
T. D. Noe, Table of n, a(n) for n = 0..1000
J. C. Lagarias, The 3x+1 problem and its generalizations, Amer. Math. Monthly, 92 (1985), 3-23.
Index entries for linear recurrences with constant coefficients, signature (0,2,0,-1)
FORMULA
f(n) = (7n-2-(5n-2)*cos(Pi*n))/4. - Robert W. Craigen (craigen(AT)fresno.edu)
G.f.: x*(2 + x + 4*x^2)/((1 - x)^2*(1 + x)^2). - Ilya Gutkovskiy, Aug 17 2016
MAPLE
f := n-> if n mod 2 = 0 then n/2 else 3*n-1; fi;
MATHEMATICA
Table[If[OddQ[n], 3*n-1, n/2], {n, 0, 100}] (* T. D. Noe, Jun 27 2012 *)
PROG
(PARI) A001281(n)=if(n%2, 3*n-1, n>>1) \\ M. F. Hasler, Nov 29 2007
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved