login
a(n) = PrimePi(A138751(n)) - a variation of the Collatz (3n+1) map.
7

%I #23 Dec 30 2023 13:03:52

%S 1,4,2,7,4,10,5,13,6,7,19,22,9,24,10,10,11,31,33,12,35,38,14,15,45,16,

%T 47,17,48,17,55,19,20,60,22,63,66,67,24,24,25,73,25,77,26,79,83,87,31,

%U 89,31,31,93,31,32,33,33,101,102,35,104,35,113,37,115,38,122,123,41,126

%N a(n) = PrimePi(A138751(n)) - a variation of the Collatz (3n+1) map.

%C This map is a variation of the Collatz (or 3n+1) map:

%C Instead of considering the parity of the number, we look at prime(n) mod 3 to decide if this prime should be halved or doubled, before going to the next prime (A007918) and finally back to the positive integers via PrimePi (A000720).

%C Exactly as for the Collatz (3n+1) map (defined on nonnegative integers), the first element for which it is defined is its only fixed point, and all other starting values seem to end up in a cycle of length 3, here: 4 -> 7 -> 5 -> 4.

%C Except for p=3, no prime yields a prime result under the map A138750 (as can be seen using p=6k+1 or p=6k-1). Therefore instead of applying primepi() after nextprime(), one could also simply use 1+primepi().

%C The prime p=3 is also the only case where n == 2 (mod 3) is not equivalent to n != 1 (mod 3). It might have been a better choice to define A138750(x)=2x if x == 1 (mod 3), ceiling(x/2) otherwise. But since here it makes only a difference for p=3, we use the original definition (cf. A124123).

%H Paolo Xausa, <a href="/A138754/b138754.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>

%F a(n) = A000720(A138751(n)) = A000720(A007918(A138750(A000040(n)))).

%e a(4) = 7 since prime(4) = 7 == 1 (mod 3), thus A138750(7) = 2*7 = 14, nextprime(14) = 17, PrimePi(17) = 7 (i.e., 17 is the 7th prime).

%e a(5) = 4 since prime(5) = 11 == 2 (mod 3), thus A138750(11) = ceiling(11/2) = 6, nextprime(6) = 7, PrimePi(7) = 4 (i.e., 7 is the 4th prime).

%t A138754[n_]:=With[{p=Prime[n]},PrimePi[NextPrime[If[Mod[p,3]==2,p/2,2p]]]];Array[A138754,100] (* _Paolo Xausa_, Jul 28 2023 *)

%o (PARI) A138754(n)=primepi(A138751(n)) /* see there */

%Y Cf. A124123, A138750-A138753, A000040, A000720, A007918.

%K easy,nonn

%O 1,2

%A _M. F. Hasler_, Apr 01 2008