A316783 Seed values of hailstone sequences for which, by the time they first reach 1, the ratio of odd terms to even terms is exactly 1/2. (The seed value itself is included in the ratio calculation.)
4, 5, 6, 11, 14, 15, 18, 19, 25, 33, 43, 57, 59, 78, 79, 105, 135, 139, 185, 187, 191, 246, 247, 249, 254, 255, 329, 338, 339, 359, 427, 438, 439, 443, 450, 451, 478, 479, 569, 585, 590, 591, 601, 636, 637, 638, 758, 759, 767, 779, 786, 787, 801, 849, 850, 851
Offset: 1
Keywords
Examples
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.
Links
Programs
-
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]] &]
-
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
Comments