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 A320028 #39 Jun 14 2022 07:08:25 %S A320028 2,3,2,5,3,7,2,7,5,11,3,13,7,23,2,17,7,19,5,2,11,23,3,19,13,41,7,29, %T A320028 23,31,2,19,17,53,7,37,19,59,5,41,2,43,11,17,23,47,3,37,19,29,13,53, %U A320028 41,83,7,43,29,59,23,61,31,137,2,37,19,67,17,13,53,71,7,73,37,113,19,29,59,79,5,61,41,83,2,2,43,131 %N A320028 a(n) is the first prime encountered when running the Collatz algorithm (halving and tripling steps) on the number n. %C A320028 A modified version of the halving and tripling Collatz algorithm, which stops as soon as the starting number becomes a prime (instead of stopping when the starting number reaches 1). %C A320028 The plot of this sequence "completes" or "fills" the lower (empty) part of plot of A270570 and evolves in a similar fashion. %H A320028 Alessandro Polcini, <a href="/A320028/b320028.txt">Table of n, a(n) for n = 2..10000</a> (a(2024) corrected by Michel Marcus, Jun 14 2022) %H A320028 <a href="/index/3#3x1">Index entries for sequences related to 3x+1 (or Collatz) problem</a> %F A320028 a(n) <= A087272(n). - _Rémy Sigrist_, Oct 08 2018 %e A320028 a(4) is 2 because 4/2 = 2 and 2 is prime. %e A320028 a(6) is 3 because 6/2 = 3 and 3 is prime. %e A320028 a(15) is 23 because 15*3 + 1 = 46; 46/2 = 23 and 23 is prime. %e A320028 a(18) is 7 because 18/2 = 9; 9*3 + 1 = 28; 28/2 = 14; 14/2 = 7 and 7 is prime. %t A320028 Array[NestWhile[If[EvenQ@ #, #/2, 3 # + 1] &, #, ! PrimeQ@ # &] &, 86, 2] (* _Michael De Vlieger_, Nov 07 2018 *) %o A320028 (Java) int collatzPrime(int i) { %o A320028 while(!BigInteger.valueOf(i).isProbablePrime(10) && i > 1) { %o A320028 if(i % 2 == 0) %o A320028 i /= 2; %o A320028 else %o A320028 i = 3 * i + 1; %o A320028 } %o A320028 return i; %o A320028 } %o A320028 (PARI) a(n) = {while (!isprime(n), if (n % 2, n = 3*n+1, n = n/2);); n;} \\ _Michel Marcus_, Oct 28 2018 %Y A320028 Cf. A087272, A270570. %K A320028 nonn %O A320028 2,1 %A A320028 _Alessandro Polcini_, Oct 03 2018