%I #36 Nov 13 2023 17:54:34
%S 0,2,1,6,2,5,2,4,4,3,3,5,3,8,5,13,4,4,7,4,4,6,12,9,6,9,6,6,14,5,8,11,
%T 5,8,5,5,5,16,13,13,13,13,10,7,10,10,7,15,15,15,12,15,15,12,12,12,9,6,
%U 12,6,12,6,17,6,14,6,17,14,14,11,11,14,14,14,8,11,11,14,11,8,11,16
%N a(n) is the number of steps required for the n-th odd prime number to reach 3 when iterating the following hailstone map: If P+1 == 0 (mod 6), then the next number = smallest prime >= P + (P-1)/2; otherwise the next number = largest prime <= (P+1)/2.
%C Conjecture: This hailstone operation on odd prime numbers will always reach 3.
%C If the condition "(P + (P-1)/2)" is changed to "(P + (P+1)/2)" then some prime numbers will go into a loop. For example, 449 will loop through 2609.
%C If the condition "(P+1)/2" is changed to "(P+3)/2" then some prime numbers will go into a loop. For example, 5 will go into the loop 5,7,5,7,....
%H Paolo Xausa, <a href="/A365048/b365048.txt">Table of n, a(n) for n = 1..10000</a>
%e Case 3: 0 steps required.
%e Case 5: 2 steps required: 5,7,3.
%e Case 7: 1 step required: 7,3.
%e Case 11: 6 steps required: 11,17,29,43,19,7,3.
%e case 17: 5 steps required: 17,29,43,19,7,3.
%t A365048[n_]:=Length[NestWhileList[If[Divisible[#+1,6],NextPrime[#+(#-1)/2-1],NextPrime[(#+1)/2+1,-1]]&,Prime[n+1],#>3&]]-1;Array[A365048,100] (* _Paolo Xausa_, Nov 13 2023 *)
%o (Python)
%o from sympy import nextprime, prevprime
%o def hailstone(prime):
%o if (prime + 1) % 6 == 0:
%o jump = prime + ((prime - 1) / 2)
%o jump = nextprime(jump - 1)
%o else:
%o jump = ((prime + 1) / 2)
%o jump = prevprime(jump + 1)
%o return jump
%o q = 2
%o lst = []
%o while q < 3000:
%o count = 0
%o p = nextprime(q)
%o q = p
%o while p != 3:
%o p = hailstone(p)
%o count = count + 1
%o lst.append(count)
%Y Cf. A007528, A065091 (odd primes).
%K nonn
%O 1,2
%A _Najeem Ziauddin_, Oct 21 2023