OFFSET
1,3
COMMENTS
For n < 10^10, if n <> 27, f(n) is finite, f(n) < 3n + 1. If n = 27 = 3^3, f(n) = 82 = 81 + 1 = 3^4 + 1 = 3n + 1. I conjecture that for any n <> 27, f(n) is finite, f(n) < 3n + 1. - Sergey Pavlov, Jun 02 2019. Note that this conjecture is stronger than the Collatz conjecture. - Andrey Zabolotskiy, Jun 13 2019
REFERENCES
R. K. Guy, Unsolved Problems in Number Theory, E16
LINKS
EXAMPLE
For n=5, Collatz trajectory for 5 is: 5,16,8,4,2,1; hence no. of transitions between odd and even parity is a(5)=2; similarly for n=11, Collatz trajectory gives 11,34,17,52,26,13,40,20,10,5,16,8,4,2,1; implies that a(11)=8.
MATHEMATICA
Collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; parity[n_] := If[OddQ[n], 1, 0]; Table[p = parity /@ Collatz[n]; If[OddQ[n], 2*Total[p] - 2, 2*Total[p] - 1], {n, 100}] (* T. D. Noe, Feb 24 2013 *)
PROG
(PARI) next_iter(n) = if(n%2==0, return(n/2), return(3*n+1))
parity(n) = n%2
a(n) = my(x=n, par=parity(x), i=0); while(x > 1, x=next_iter(x); if(parity(x)!=par, i++; par=parity(x))); i \\ Felix Fröhlich, Jun 02 2019
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Jayanta Basu, Feb 20 2013
STATUS
approved