OFFSET
1,4
COMMENTS
1. The Collatz function (related to the "3x+1 problem") is defined by: f(n) = n/2 if n is even; f(n) = 3n + 1 if n is odd. A famous conjecture states that n, f(n), f(f(n)), .... eventually reaches 1. 2. It appears that a(n) > 0 for all n. The mean of {a(1), a(2), ...., a(N)} seems to be close to 3/2 for large N. That is, there are about 3 even to 2 odd terms in N, f(N), f(f(N)), ...., 1. Hence f1(n) = n/2 will be applied about three times and f2(n) = 3n+1 about two times, in N, f(N), f(f(N)), ...., 1. Heuristically, one can see why 1 must eventually be reached by N, f(N), f(f(N)), .... For example, considering a sample sequence of 3 applications of f1 and 2 applications of f2: f1(f1(f1(f2(f2(N))))) = (9/32)N + 5/16, which makes N much smaller.
LINKS
EXAMPLE
The terms n, f(n), f(f(n)), ...., 1 for n = 12 are: 12, 6, 3, 10, 5, 16, 8, 4, 2, 1, of which 7 are even and 3 are odd. Hence a(12) = Floor(7/3) = 2.
MATHEMATICA
f[n_] := Module[{a, i, o}, i = n; o = 1; a = {}; While[i > 1, If[Mod[i, 2] == 1, o = o + 1]; a = Append[a, i]; i = f[i]]; o]; Table[f[i], {i, 1, 100}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Joseph L. Pe, Dec 20 2002
EXTENSIONS
Escape clause added to definition by N. J. A. Sloane, Jun 06 2017
STATUS
approved