%I #22 Apr 25 2022 08:04:03
%S 2,4,5,7,10,10,10,13,11,16,20,19,23,22,23,25,20,28,38,31,37,34,46,37,
%T 29,40,47,43,38,46,61,49,38,52,61,55,64,58,76,61,47,64,74,67,61,70,91,
%U 73,56,76,61,79,91,82,61,85,65,88,101,91,118,94,77,97,74,100,86,103
%N Follow trajectory of 2n+1 in the '3x+1' problem until a lower number is reached; A060445 gives number of steps for this to happen. Sequence gives the first lower number that is reached.
%H Alois P. Heinz, <a href="/A060565/b060565.txt">Table of n, a(n) for n = 1..20000</a>
%H <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%p b:= proc(n, t) option remember; `if`(n<t, n,
%p b(`if`(n::even, n/2, 3*n+1), t))
%p end:
%p a:= n-> b((2*n+1)$2):
%p seq(a(n), n=1..80); # _Alois P. Heinz_, Jan 22 2022
%t b[n_, t_] := b[n, t] = If[n<t, n, b[If[EvenQ[n], n/2, 3n+1], t]];
%t a[n_] := b[2n+1, 2n+1];
%t Table[a[n], {n, 1, 80}] (* _Jean-François Alcover_, Apr 25 2022, after _Alois P. Heinz_ *)
%o (PARI) a(n) = my(N=2*n+1, m=N); while(m >= N, m = if (m%2, 3*m+1, m/2)); m; \\ _Michel Marcus_, Jan 22 2022
%Y Cf. A060445.
%K nonn,easy
%O 1,1
%A _N. J. A. Sloane_, Apr 12 2001
%E More terms from Larry Reeves (larryr(AT)acm.org), Apr 13 2001