OFFSET
1,2
COMMENTS
Conjecture: This hailstone operation on odd prime numbers will always reach 3.
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.
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,....
LINKS
Paolo Xausa, Table of n, a(n) for n = 1..10000
EXAMPLE
Case 3: 0 steps required.
Case 5: 2 steps required: 5,7,3.
Case 7: 1 step required: 7,3.
Case 11: 6 steps required: 11,17,29,43,19,7,3.
case 17: 5 steps required: 17,29,43,19,7,3.
MATHEMATICA
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 *)
PROG
(Python)
from sympy import nextprime, prevprime
def hailstone(prime):
if (prime + 1) % 6 == 0:
jump = prime + ((prime - 1) / 2)
jump = nextprime(jump - 1)
else:
jump = ((prime + 1) / 2)
jump = prevprime(jump + 1)
return jump
q = 2
lst = []
while q < 3000:
count = 0
p = nextprime(q)
q = p
while p != 3:
p = hailstone(p)
count = count + 1
lst.append(count)
CROSSREFS
KEYWORD
nonn
AUTHOR
Najeem Ziauddin, Oct 21 2023
STATUS
approved