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.

Showing 1-2 of 2 results.

A347409 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

0, 1, 4, 2, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 6, 4, 5, 4, 4, 4, 5, 4, 4, 5, 5, 5, 4, 4, 5, 4, 4, 4, 4, 4, 5, 6, 4, 4, 4, 5, 5, 4, 4, 4, 4, 4, 5, 5, 5, 4, 4, 4, 4, 5, 5, 5, 5, 6, 4, 4, 4, 4, 4, 5, 5, 4, 5, 4, 8, 4, 4, 4, 4, 4, 5, 5, 5, 6, 8, 4, 4
Offset: 1

Views

Author

Paolo Xausa, Aug 30 2021

Keywords

Comments

If the longest run of halving steps occurs as the final part of the trajectory, a(n) = A135282(n), otherwise a(n) > A135282(n).
Every nonnegative integer appears in the sequence at least once, since for any k >= 0 a(2^k) = k.
Conjecture: every integer >= 4 appears in the sequence infinitely many times.

Examples

			a(15) = 5 because the Collatz trajectory starting at 15 contains, as the longest halving run, a 5-step subtrajectory (namely, 160 -> 80 -> 40 -> 20 -> 10 -> 5).
		

Crossrefs

Cf. A347668 (indices of records), A347669 (indices of first occurrences), A348007.

Programs

  • Mathematica
    nterms=100;Table[c=n;sm=0;While[c>1,If[OddQ[c],c=3c+1,If[(s=IntegerExponent[c,2])>sm,sm=s];c/=2^s]];sm,{n,nterms}]
  • PARI
    a(n)=my(nb=0); while (n != 1, if (n % 2, n=3*n+1, my(x = valuation(n, 2)); n /= 2^x; nb = max(nb, x));); nb; \\ Michel Marcus, Sep 03 2021
    
  • Python
    def A347409(n):
        m, r = n, 0
        while m > 1:
            if m % 2:
                m = 3*m + 1
            else:
                s = bin(m)[2:]
                c = len(s)-len(s.rstrip('0'))
                m //= 2**c
                r = max(r,c)
        return r # Chai Wah Wu, Sep 29 2021

A347668 Indices of records in A347409.

Original entry on oeis.org

1, 2, 3, 15, 21, 75, 151, 1365, 5461, 7407, 14563, 87381, 184111, 932067, 5592405, 13256071, 26512143, 357913941, 1431655765, 3817748707, 22906492245, 91625968981, 244335917283, 1466015503701, 5212499568715, 10424999137431, 93824992236885
Offset: 1

Views

Author

Paolo Xausa, Sep 10 2021

Keywords

Comments

Conjecture 1: A347409(a(n)) is even for n >= 11. Conjecture 2: all even numbers > 2 appear as A347409(a(n)) for some n. - Chai Wah Wu, Sep 29 2021
If conjectures 1 and 2 are true, then A347409(a(n)) = 2n - 6 for n >= 11, and hence a(n) <= (4^(n-3)-1)/3 for n >= 11 since A347409((4^(n-3)-1)/3) = 2n - 6. - Charles R Greathouse IV, Oct 25 2022

Crossrefs

Programs

  • Mathematica
    A347409[n_]:=(c=n;sm=0;While[c>1,If[OddQ[c],c=3c+1,If[(s=IntegerExponent[c,2])>sm,sm=s];c/=2^s]];sm)
    upto=100000;a={};rec=-1;Do[If[(r=A347409[i])>rec,rec=r;AppendTo[a,i]],{i,upto}];a
  • PARI
    f(n)=my(nb=0); while (n != 1, if (n % 2, n=3*n+1, my(x = valuation(n, 2)); n /= 2^x; nb = max(nb, x)); ); nb; \\ A347409
    lista(nn) = my(r=-1, m); for (n=1, nn, if ((m=f(n)) > r, print1(n, ", "); r = m);); \\ Michel Marcus, Sep 10 2021

Extensions

a(15) from Michel Marcus, Sep 10 2021
a(16)-a(17) from Alois P. Heinz, Sep 10 2021
a(18)-a(20) from Michael S. Branicky, Sep 28 2021
a(21)-a(22) from Michael S. Branicky, Sep 30 2021
a(23) from Michael S. Branicky, Oct 04 2021
a(24)-a(27) from Kevin P. Thompson, Apr 14 2022
Showing 1-2 of 2 results.