Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #36 Oct 20 2019 21:52:15
%S 0,1,3,2,3,4,6,3,7,4,6,5,5,7,7,4,6,8,8,5,5,7,7,6,9,6,29,8,8,8,28,5,10,
%T 7,7,9,9,9,12,6,29,6,11,8,8,8,28,7,10,10,10,7,7,30,30,9,12,9,12,9,9,
%U 29,29,6,11,11,11,8,8,8,28,10,31,10,8,10,10,13
%N Difference between number of halving steps and number of tripling steps needed to reach 1 in '3x+1' problem.
%C This sequence can also be defined as: a(1) = 0; thereafter a(2*k) = a(k) + 1, a(2*k+1) = a(6*k+4) - 1. - _Gionata Neri_, Jul 17 2016
%H Alois P. Heinz, <a href="/A220071/b220071.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n) = A006666(n) - A006667(n).
%p a:= proc(n) option remember; `if`(n<2, 0,
%p `if`(irem(n, 2)=0, 1+a(n/2), a((3*n+1)/2)))
%p end:
%p seq(a(n), n=1..100); # _Alois P. Heinz_, Feb 19 2013
%t coll[n_] := NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, n, # > 1 &]; Table[(x = Count[coll[n], _?EvenQ]) - (Length[coll[n]] - x - 1), {n, 78}] (* _Jayanta Basu_, Aug 15 2013 *)
%Y Cf. A006577, A006666, A006667, A014682.
%K nonn
%O 1,3
%A _Jayanta Basu_, Feb 19 2013
%E More terms from _Alois P. Heinz_, Feb 19 2013