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.

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.

This page as a plain text file.
%I A361733 #61 May 13 2023 13:45:50
%S A361733 4,7,17,12,113,17,79,22,51,33,64,35,128,56,110,53,84,128,107,115,175,
%T A361733 82,477,172,141,182,188,110,159,167,301,206,151,146,128,195,190,299,
%U A361733 208,276,180,185,500,203,229,190,265,270,288,252,299,208,350,348,459,330,314,268,490,361,578
%N 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.
%C A361733 k = 10^n - 1 = A002283(n) is the repdigit consisting of n digits, all 9s.
%C A361733 The sequence seems to be chaotic but broadly increasing.
%C A361733 By contrast, repdigits of 1, 3, 5, or 7, have constant dropping times after a few initial values each.
%H A361733 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>
%F A361733 a(n) = A074473(10^n-1).
%e A361733 a(1) = 4 as for k = 9, the Collatz trajectory begins 9, 28, 14, 7, ...;
%e A361733 a(2) = 7 as for k = 99, the Collatz trajectory begins 99, 298, 149, 448, 224, 112, 56, ...;
%e A361733 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, ... .
%t A361733 collatzLen[a_Integer] := Module[{len = 1, x = a},
%t A361733   While[x >= a,    If[Mod[x, 2] > 0,
%t A361733       x = 3 x + 1,
%t A361733       x = Quotient[x, 2]
%t A361733     ];
%t A361733     len++
%t A361733   ];
%t A361733   Return[len]
%t A361733 ]
%o A361733 (Python)
%o A361733 def collatz_len(a):
%o A361733     length = 1
%o A361733     x = a
%o A361733     while x >= a:
%o A361733         if x % 2 > 0:
%o A361733             x = 3 * x + 1
%o A361733         else:
%o A361733             x = x // 2
%o A361733         length += 1
%o A361733     return length
%o A361733 (PARI) f(n) = if (n%2, 3*n+1, n/2); \\ A006370
%o A361733 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
%o A361733 a(n) = b(10^n-1); \\ _Michel Marcus_, Mar 28 2023
%Y A361733 Cf. A074473, A002283, A006370, A074474, A075483, A075480.
%K A361733 nonn
%O A361733 1,1
%A A361733 _Paul M. Bradley_, Mar 22 2023