OFFSET
1,3
COMMENTS
next_prime(x) is the next prime >= x, and previous_prime(x) is the next prime <= x.
Conjecture: This hailstone operation on prime numbers will always reach 2.
The map does not go into a loop for any starting prime.
EXAMPLE
For n=1, prime(1)=2, requires a(1)=0 steps to reach 2.
For n=2, prime(2)=3, requires a(2)=1 step: 3 -> 2.
For n=3, prime(3)=5, requires a(3)=8 steps: 5 -> 11 -> 17 -> 23 -> 29 -> 37 -> 7 -> 3 -> 2.
PROG
(Python)
from sympy import nextprime, prevprime
from math import isqrt
def hailstone(prime):
if (prime + 1) % 6 == 0:
jump = prime + isqrt(prime-1) + 1
jump = nextprime(jump - 1)
else:
jump = isqrt(prime-1) + 1
jump = prevprime(jump + 1)
return jump
def a(n):
p = nextprime(1, n)
count = 0
while p != 2:
p = hailstone(p)
count += 1
return count
CROSSREFS
KEYWORD
nonn
AUTHOR
Najeem Ziauddin, Nov 19 2023
STATUS
approved