This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A367479 #36 Jun 23 2024 16:08:45 %S A367479 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, %T A367479 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, %U A367479 7,11,10,10,11,10,11,11 %N 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. %C A367479 next_prime(x) is the next prime >= x, and previous_prime(x) is the next prime <= x. %C A367479 Conjecture: This hailstone operation on prime numbers will always reach 2. %C A367479 The map does not go into a loop for any starting prime. %e A367479 For n=1, prime(1)=2, requires a(1)=0 steps to reach 2. %e A367479 For n=2, prime(2)=3, requires a(2)=1 step: 3 -> 2. %e A367479 For n=3, prime(3)=5, requires a(3)=8 steps: 5 -> 11 -> 17 -> 23 -> 29 -> 37 -> 7 -> 3 -> 2. %o A367479 (Python) %o A367479 from sympy import nextprime, prevprime %o A367479 from math import isqrt %o A367479 def hailstone(prime): %o A367479 if (prime + 1) % 6 == 0: %o A367479 jump = prime + isqrt(prime-1) + 1 %o A367479 jump = nextprime(jump - 1) %o A367479 else: %o A367479 jump = isqrt(prime-1) + 1 %o A367479 jump = prevprime(jump + 1) %o A367479 return jump %o A367479 def a(n): %o A367479 p = nextprime(1,n) %o A367479 count = 0 %o A367479 while p != 2: %o A367479 p = hailstone(p) %o A367479 count += 1 %o A367479 return count %Y A367479 Cf. A007528. %Y A367479 Similar sequence: A365048. %K A367479 nonn %O A367479 1,3 %A A367479 _Najeem Ziauddin_, Nov 19 2023