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.
%I A348007 #30 Nov 12 2021 12:31:48 %S A348007 2,16,4,16,16,16,8,16,16,16,16,16,16,160,16,16,16,16,16,64,16,160,16, %T A348007 16,16,160,16,16,160,160,32,16,16,160,16,112,16,304,16,160,64,112,16, %U A348007 16,160,160,48,112,16,16,16,160,160,160,16,112,16,304,160,160,160 %N A348007 Starting value of the longest run of halving steps in the trajectory from n to 1 in the Collatz map (or 3x+1 problem), or -1 if no such trajectory exists. %C A348007 In case of ties (two or more longest runs of same length), the highest starting value is picked. The first n for which the longest run of halving steps occurs at two different subtrajectories is 37, where the Collatz map contains the 4-step subtrajectories 112 -> 56 -> 28 -> 14 > 7 and 16 -> 8 -> 4 -> 2 -> 1. a(37) is therefore 112 (highest starting value). %C A348007 If the Collatz conjecture (i.e., all trajectories reach 1) is true then, except for n = 2, 4 and 8, a(n) mod 16 = 0, since all trajectories contain (at least) 4 consecutive halvings. %H A348007 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a> %F A348007 a(2^k) = 2^k, for integers k >= 1. %F A348007 a(n) mod 2^A347409(n) = 0. %e A348007 a(2) = 2 because the Collatz trajectory from 2 to 1 is simply 2 -> 1 (one halving step, starting at 2). %e A348007 a(3) = 16 because the trajectory from 3 to 1 is 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1. Here, the longest halving run is the 4-step subtrajectory 16 -> 8 -> 4 -> 2 -> 1, which starts at 16. %e A348007 a(15) = 160 because the longest halving run in the trajectory from 15 to 1 (the 5-step subtrajectory 160 -> 80 -> 40 -> 20 -> 10 -> 5) starts at 160. %t A348007 nterms=100;Table[c=n;cm=sm=0;While[c>1,If[OddQ[c],c=3c+1,s=IntegerExponent[c,2];If[s>sm,sm=s;cm=c,If[s==sm,cm=Max[cm,c]]];c/=2^s]];cm,{n,2,nterms+1}] %o A348007 (PARI) A348007(n) = { my(m2v=valuation(n,2), mx=n, t); while(n>1, if((t=valuation(n,2))>m2v, m2v=t; mx=n, if(t==m2v && n>mx, mx=n)); if(!(n%2),n/=2,n+=(n+n+1))); (mx); }; \\ _Antti Karttunen_, Oct 13 2021 %Y A348007 Cf. A006370, A070165, A135282, A347409. %K A348007 nonn %O A348007 2,1 %A A348007 _Paolo Xausa_, Sep 24 2021