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.

A348006 Largest increment in the trajectory from n to 1 in the Collatz map (or 3x+1 problem), or -1 if no such trajectory exists.

This page as a plain text file.
%I A348006 #56 Oct 25 2022 00:41:59
%S A348006 0,0,11,0,11,11,35,0,35,11,35,11,27,35,107,0,35,35,59,11,43,35,107,11,
%T A348006 59,27,6155,35,59,107,6155,0,67,35,107,35,75,59,203,11,6155,43,131,35,
%U A348006 91,107,6155,11,99,59,155,27,107,6155,6155,35,131,59,203,107
%N A348006 Largest increment in the trajectory from n to 1 in the Collatz map (or 3x+1 problem), or -1 if no such trajectory exists.
%C A348006 The largest increment occurs when the trajectory reaches its largest value via a 3x+1 step.
%C A348006 All nonzero terms are odd, since they are of the form 2k+1, for some k >= 5.
%H A348006 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%F A348006 If n = 2^k (for k >= 0), a(n) = 0; otherwise a(n) = 2*A087232(n)+1 = (2*A025586(n)+1)/3 = A025586(n)-A087232(n).
%e A348006 a(3) = 11 because the trajectory starting at 3 is 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1, and the largest increment (from 5 to 16) is 11.
%e A348006 a(4) = 0 because there are only halving steps in the Collatz trajectory starting at 4.
%t A348006 nterms=100;Table[c=n;mr=0;While[c>1,If[OddQ[c],mr=Max[mr,2c+1];c=3c+1,c/=2^IntegerExponent[c,2]]];mr,{n,nterms}]
%o A348006 (Python)
%o A348006 def A348006(n):
%o A348006     c, mr = n, 0
%o A348006     while c > 1:
%o A348006         if c % 2:
%o A348006             mr = max(mr, 2*c+1)
%o A348006             c = 3*c+1
%o A348006         else:
%o A348006             c //= 2
%o A348006     return mr
%o A348006 print([A348006(n) for n in range(1, 100)])
%o A348006 (PARI) a(n)=n>>=valuation(n,2); my(r); while(n>1, my(t=2*n+1); n+=t; n>>=valuation(n,2); if(t>r, r=t)); r \\ _Charles R Greathouse IV_, Oct 25 2022
%Y A348006 Cf. A006370, A025586, A070165, A087232.
%K A348006 nonn,easy
%O A348006 1,3
%A A348006 _Paolo Xausa_, Oct 02 2021