login
The Collatz or 3x+1 function T (A014682) conjugated by unary-binary-encoding (A156552).
3

%I #7 Feb 15 2021 22:50:56

%S 1,3,2,6,3,7,5,12,4,27,7,14,11,75,6,24,13,35,17,54,10,147,19,28,9,363,

%T 8,150,23,13,29,48,14,507,15,70,31,867,22,108,37,343,41,294,12,1083,

%U 43,56,25,63,26,726,47,175,21,300,34,1587,53,26,59,2523,20,96,33,847,61,1014,38,243,67,140,71,2883,18,1734

%N The Collatz or 3x+1 function T (A014682) conjugated by unary-binary-encoding (A156552).

%C Collatz-conjecture can be formulated via this sequence by postulating that all iterations of a(n), starting from any n > 1, will eventually end reach the cycle [2, 3].

%H Antti Karttunen, <a href="/A341516/b341516.txt">Table of n, a(n) for n = 1..10000</a>

%H <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a>

%H <a href="/index/Pri#prime_indices">Index entries for sequences computed from indices in prime factorization</a>

%F If n is odd, then a(n) = A064989(n), otherwise a(n) = A064989(A329603(n)).

%F a(n) = A005940(1+A014682(A156552(n))).

%o (PARI)

%o A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); (t); };

%o 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 A156552(n) = { my(f = factor(n), 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 A329603(n) = A005940(2+(3*A156552(n)));

%o A341516(n) = if(n%2, A064989(n), A064989(A329603(n)));

%Y Cf. A005940, A014682, A064989, A156552, A329603.

%Y Cf. A341515 for a variant.

%K nonn

%O 1,2

%A _Antti Karttunen_, Feb 15 2021