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.

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.

Original entry on oeis.org

2, 16, 4, 16, 16, 16, 8, 16, 16, 16, 16, 16, 16, 160, 16, 16, 16, 16, 16, 64, 16, 160, 16, 16, 16, 160, 16, 16, 160, 160, 32, 16, 16, 160, 16, 112, 16, 304, 16, 160, 64, 112, 16, 16, 160, 160, 48, 112, 16, 16, 16, 160, 160, 160, 16, 112, 16, 304, 160, 160, 160
Offset: 2

Views

Author

Paolo Xausa, Sep 24 2021

Keywords

Comments

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).
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.

Examples

			a(2) = 2 because the Collatz trajectory from 2 to 1 is simply 2 -> 1 (one halving step, starting at 2).
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.
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.
		

Crossrefs

Programs

  • Mathematica
    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}]
  • 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

Formula

a(2^k) = 2^k, for integers k >= 1.
a(n) mod 2^A347409(n) = 0.