OFFSET
1,1
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.
LINKS
FORMULA
a(n) = A074473(10^n-1).
EXAMPLE
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, ... .
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]
]
PROG
(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
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Paul M. Bradley, Mar 22 2023
STATUS
approved