OFFSET
1,1
COMMENTS
1/2 is the most common odd/even ratio for these sequences. For seed values from 2 to 2^17, it is the odd/even ratio for 4454 of those sequences. The next most common ratio is 5/11, with 1834 sequences. (This is all empirical observation, using Mathematica.)
LINKS
FORMULA
EXAMPLE
The hailstone sequence starting with 11 (and ending at 1) is 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1. Five of those terms are odd, and the other ten are even, giving an odd/even ratio of 1/2. Therefore 11 is a term in this sequence.
MAPLE
b:= proc(n) option remember; `if`(n=1, [1, 0],
`if`(n::odd, [1, 0]+b(3*n+1), [0, 1]+b(n/2)))
end:
a:= proc(n) option remember; local k; for k from a(n-1)
+1 while (l-> 2*l[1]<>l[2])(b(k)) do od; k
end: a(0):=0:
seq(a(n), n=1..100); # Alois P. Heinz, Aug 02 2018
MATHEMATICA
collatz[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1]&, n, # != 1 &];
A316783 = Select[Range[2, 1000], With[{c = Mod[collatz[#], 2]}, 2 Total[c] == Total[1 - c]] &]
PROG
(PARI) is(n) = my(x=n, even=0, odd=0); while(1, if(x%2==0, x=x/2; even++, x=3*x+1; odd++); if(x==1, odd++; break)); odd/even==1/2 \\ Felix Fröhlich, Jul 13 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Matt Enlow, Jul 13 2018
STATUS
approved