cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A220421 Number of halving and tripling steps to reach the largest value in the Collatz (3x+1) trajectory of n.

This page as a plain text file.
%I A220421 #67 Sep 05 2025 10:23:49
%S A220421 0,0,3,0,1,4,5,0,8,2,3,5,1,6,7,0,1,9,3,0,1,4,5,0,6,2,77,7,1,8,72,0,1,
%T A220421 2,3,10,1,4,10,0,75,2,3,5,1,6,70,0,1,7,3,0,1,78,78,0,6,2,8,9,1,73,73,
%U A220421 0,1,2,3,0,1,4,68,0,81,2,3,5,1,11,7,0,1,76
%N A220421 Number of halving and tripling steps to reach the largest value in the Collatz (3x+1) trajectory of n.
%C A220421 a(n) = 0 if n is a power of 2, as a(1) = a(2) = a(4) = ... = 0; however a(20) = a(24) = ... = 0 also and as such the condition (n = 2^k, k>=0) is sufficient but not necessary for a(n) = 0.
%H A220421 Alois P. Heinz, <a href="/A220421/b220421.txt">Table of n, a(n) for n = 1..10000</a>
%F A220421 a(n) = A087225(n) - 1.
%e A220421 a(3) = 3 because the Collatz trajectory for 3 is [3, 10, 5, 16, 8, 4, 2, 1], reaching the largest term, 16, in three steps.
%e A220421 a(4) = 0 because the Collatz trajectory only goes down from 4.
%e A220421 a(20) = 0: 20 is the largest term in [20, 10, 5, 16, 8, 4, 2, 1].
%t A220421 Collatz[n_] :=NestWhileList[If[EvenQ[#], #/2, 3*# + 1] &, n, # > 1 &]; Table[Position[Collatz[n], Max[Collatz[n]]][[1, 1]] - 1, {n, 82}] (* _Jayanta Basu_, Mar 24 2013 *)
%Y A220421 Cf. A006577, A014682, A025586.
%K A220421 nonn,changed
%O A220421 1,3
%A A220421 _Jayanta Basu_, Feb 19 2013
%E A220421 More terms from _Alois P. Heinz_, Feb 20 2013