login
A367479
a(n) is the number of steps required for prime(n) to reach 2 when iterating the following hailstone map: If P == 5 (mod 6), then P -> next_prime(P + ceiling(sqrt(P))), otherwise P -> previous_prime(ceiling(sqrt(P))); or a(n) = -1 if prime(n) never reaches 2.
0
0, 1, 8, 2, 7, 2, 6, 9, 5, 4, 9, 3, 5, 3, 5, 4, 4, 3, 3, 5, 3, 3, 4, 11, 3, 10, 8, 9, 8, 9, 8, 5, 5, 8, 4, 3, 3, 3, 4, 5, 4, 3, 4, 3, 4, 3, 3, 3, 15, 3, 15, 9, 3, 14, 8, 9, 13, 7, 7, 8, 7, 12, 7, 11, 7, 11, 10, 10, 11, 10, 11, 11
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
Cf. A007528.
Similar sequence: A365048.
Sequence in context: A153203 A261829 A244686 * A317386 A306994 A152179
KEYWORD
nonn
AUTHOR
Najeem Ziauddin, Nov 19 2023
STATUS
approved