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.

User: Paul M. Bradley

Paul M. Bradley's wiki page.

Paul M. Bradley has authored 1 sequences.

A361733 Length of the Collatz (3x + 1) trajectory from k = 10^n - 1 to a term less than k, or -1 if the trajectory never goes below k.

Original entry on oeis.org

4, 7, 17, 12, 113, 17, 79, 22, 51, 33, 64, 35, 128, 56, 110, 53, 84, 128, 107, 115, 175, 82, 477, 172, 141, 182, 188, 110, 159, 167, 301, 206, 151, 146, 128, 195, 190, 299, 208, 276, 180, 185, 500, 203, 229, 190, 265, 270, 288, 252, 299, 208, 350, 348, 459, 330, 314, 268, 490, 361, 578
Offset: 1

Author

Paul M. Bradley, Mar 22 2023

Keywords

Comments

k = 10^n - 1 = A002283(n) is the repdigit consisting of n digits, all 9s.
The sequence seems to be chaotic but broadly increasing.
By contrast, repdigits of 1, 3, 5, or 7, have constant dropping times after a few initial values each.

Examples

			a(1) = 4 as for k = 9, the Collatz trajectory begins 9, 28, 14, 7, ...;
a(2) = 7 as for k = 99, the Collatz trajectory begins 99, 298, 149, 448, 224, 112, 56, ...;
a(3) = 17 as for k = 999, the Collatz trajectory begins 999, 2998, 1499, 4498, 2249, 6748, 3374, 1687, 5062, 2531, 7594, 3797, 11392, 5696, 2848, 1424, 712, ... .
		

Programs

  • Mathematica
    collatzLen[a_Integer] := Module[{len = 1, x = a},
      While[x >= a,    If[Mod[x, 2] > 0,
          x = 3 x + 1,
          x = Quotient[x, 2]
        ];
        len++
      ];
      Return[len]
    ]
  • PARI
    f(n) = if (n%2, 3*n+1, n/2); \\ A006370
    b(n) = if (n<3, return(n)); my(m=n, nb=0); while (1, m = f(m); nb++; if (m < n, return(nb+1));); \\ A074473
    a(n) = b(10^n-1); \\ Michel Marcus, Mar 28 2023
  • Python
    def collatz_len(a):
        length = 1
        x = a
        while x >= a:
            if x % 2 > 0:
                x = 3 * x + 1
            else:
                x = x // 2
            length += 1
        return length
    

Formula

a(n) = A074473(10^n-1).