%I #48 Aug 08 2023 18:39:38
%S 0,7,16,17,106,107,46,47,61,62,156,157,158,159,129,130,224,225,177,
%T 178,303,304,473,474,444,445,384,385,448,449,450,451,527,528,529,530,
%U 531,532,533,534,535,536,586,587,588,589,590,591,592,593,594,595,852
%N Number of steps to reach 1 in Collatz (3x+1) problem starting with 2^n - 1.
%H Arkadiusz Wesolowski, <a href="/A193688/b193688.txt">Table of n, a(n) for n = 1..10000</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/CollatzProblem.html">Collatz Problem</a>
%H <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%F For larger n, a(n) ~ 13.5*n.
%F a(n) = A006577(A000225(n)). - _Michel Marcus_, Jul 11 2023
%F a(2n) = 1 + a(2n-1) for n >= 2. - _Alexandre Herrera_, Jul 11 2023
%t Table[Length[NestWhileList[If[OddQ@#, 3 # + 1, #/2] &, 2^n - 1, # > 1 &]] - 1, {n, 60}] (* _Arkadiusz Wesolowski_, Sep 16 2011 *)
%o (Python)
%o for i in range(1, 100):
%o n = 2**i - 1
%o x = n
%o c = 0
%o while x != 1:
%o c = c + 1
%o if (x & 1) == 0:
%o x = x//2
%o else:
%o x = 3*x + 1
%o print(c)
%o # _David Rabahy_, Sep 18 2017
%Y Cf. A000225, A006577, A179118 (starting with 2^n+1).
%K nonn
%O 1,2
%A _Arkadiusz Wesolowski_, Aug 02 2011
|