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-3 of 3 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

A347669 Indices of first occurrences of n in A347409.

Original entry on oeis.org

1, 2, 4, 8, 3, 15, 21, 128, 75, 512, 151, 2048, 1365, 8192, 5461, 7407, 14563, 131072, 87381, 524288, 184111, 2097152, 932067, 6213783, 5592405, 33554432, 13256071, 134217728, 26512143, 530242875, 357913941, 1899273247, 1431655765, 8589934592, 3817748707, 34359738368
Offset: 0

Views

Author

Paolo Xausa, Sep 10 2021

Keywords

Examples

			a(5) = 15 because 5 occurs for the first time at position 15 in A347409.
		

Crossrefs

Programs

  • Mathematica
    A347409[n_]:=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)
    nterms=20;Table[i=0;While[A347409[++i]!=n];i,{n,0,nterms-1}]
  • 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
    a(n) = my(k=1); while (f(k) != n, k++); k; \\ Michel Marcus, Sep 10 2021

Extensions

a(21)-a(22) from Michel Marcus, Sep 10 2021
a(23)-a(28) from Alois P. Heinz, Sep 11 2021
a(29)-a(34) from Michael S. Branicky, Sep 28 2021
a(35) from Chai Wah Wu, Oct 02 2021

A350370 a(n) is the smallest k such that the Collatz sequence for k includes a record number of consecutive tripling steps.

Original entry on oeis.org

1, 3, 7, 15, 27, 127, 255, 511, 1023, 1819, 4095, 4255, 16383, 32767, 65535, 77671, 262143, 459759, 1048575, 2097151, 4194303, 7456539, 16777215, 33554431, 67108863, 125687199, 1073741823, 2147483647, 4294967295, 8589934591, 17179869183, 20361326439, 68719476735
Offset: 1

Views

Author

Kevin P. Thompson, Dec 27 2021

Keywords

Comments

See A350369 for a description of "consecutive tripling steps."
Records for A350369, recorded by the Collatz sequence starting value.
Differs from A213215 in that repeated values are removed, i.e., if a gap in the number of consecutive tripling steps occurs, A213215 will report the starting value multiple times but this sequence will not. Example: The Collatz sequence for 15 has 4 tripling steps but the sequence for 27 has 6, so 27 is reported by A213215 for n=5 and n=6. This sequence only reports 27 once as having set a new record.
Differs from A222598 in that certain consecutive tripling step lengths will not be represented here when a gap in the record number of consecutive tripling steps occurs. Example: Since the consecutive tripling step record moves from 4 in the Collatz sequence for 15 to 6 in the Collatz sequence for 27, this sequence will not report the Collatz sequence for 159 with 5 consecutive tripling steps like A222598 does.

Examples

			a(5) = 27 since the Collatz sequence for 27 is the 5th sequence to set a record for the most consecutive tripling steps, i.e., A350369(27) = 6 is the first occurrence of 6 in A350369.
		

Crossrefs

Programs

  • Mathematica
    k=0;nmax=0;Do[While[t=0;max=0;NestWhileList[If[OddQ@#,t++;If[t>max,max=t];(3#+1)/2,t=0;#/2]&,++k,#!=1&];maxGiorgos Kalogeropoulos, Jan 11 2022 *)
Showing 1-3 of 3 results.