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.
%I A352893 #11 Apr 09 2022 08:47:11 %S A352893 0,0,1,2,1,1,1,5,3,6,1,4,1,3,2,5,1,2,1,6,7,8,1,4,3,8,6,3,1,1,1,39,4, %T A352893 44,2,41,1,44,9,11,1,6,1,8,5,10,1,38,3,7,9,8,1,5,7,37,45,10,1,9,1,56, %U A352893 7,39,4,3,1,44,45,40,1,41,1,39,3,44,2,8,1,11,6,15,1,3,9,15,11,13,1,4,7,10,11,32,9,38 %N A352893 Number of iterations of map x -> A352892(x) needed to reach x <= 2 when starting from x=n, or -1 if such number is never reached. Here A352892 is the next odd term in the Collatz or 3x+1 map (A139391) conjugated by unary-binary-encoding (A156552). %H A352893 Antti Karttunen, <a href="/A352893/b352893.txt">Table of n, a(n) for n = 1..16384</a> %H A352893 Antti Karttunen, <a href="/A352893/a352893.txt">Data supplement: n, a(n) computed for n = 1..65537</a> %H A352893 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a> %H A352893 <a href="/index/Pri#prime_indices">Index entries for sequences computed from indices in prime factorization</a> %F A352893 If n <= 2, a(n) = 0, otherwise a(n) = 1 + a(A352892(n)). %F A352893 For n > 1, a(n) = A286380(A156552(n)). %F A352893 a(p) = 1 for all odd primes p. %F A352893 For n >= 1, A352894(n) <= a(n) <= A352890(n). %o A352893 (PARI) %o A352893 A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); (t); }; %o A352893 A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)}; %o A352893 A156552(n) = { my(f = factor(n), p, p2 = 1, res = 0); for(i = 1, #f~, p = 1 << (primepi(f[i, 1]) - 1); res += (p * p2 * (2^(f[i, 2]) - 1)); p2 <<= f[i, 2]); res }; %o A352893 A329603(n) = A005940(2+(3*A156552(n))); %o A352893 A341515(n) = if(n%2, A064989(n), A329603(n)); %o A352893 A348717(n) = { my(f=factor(n)); if(#f~>0, my(pi1=primepi(f[1, 1])); for(k=1, #f~, f[k, 1] = prime(primepi(f[k, 1])-pi1+1))); factorback(f); }; \\ From A348717 %o A352893 A352892(n) = A348717(A341515(n)); %o A352893 A352893(n) = { my(k=0); while(n>2, n = A352892(n); k++); (k); }; %o A352893 (PARI) %o A352893 \\ Much faster than above program: %o A352893 A139391(n) = my(x = if(n%2, 3*n+1, n/2)); x/2^valuation(x, 2); \\ From A139391 %o A352893 A286380(n) = { my(k=0); while(n>1, n = A139391(n); k++); (k); }; %o A352893 A352893(n) = if(1==n,0,A286380(A156552(n))); %Y A352893 Cf. A000040, A005940, A064989, A139391, A156552, A286380, A329603, A341515, A352890, A352892, A352894. %K A352893 nonn %O A352893 1,4 %A A352893 _Antti Karttunen_, Apr 08 2022