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 A078373 #45 May 19 2023 15:00:29 %S A078373 2,3,7,19,27,97,171,231,487,763,1071,4011,6171,10971,17647,47059, %T A078373 99151,117511,202471,260847,481959,963919,1564063,1805311,1993215, %U A078373 6991599,8400511,11200681,36791535,46564287,103359483,206718967,359502063 %N A078373 n sets a record for the number of primes in {n, f(n), f(f(n)), ..., 1}, where f is the Collatz function defined by f(x) = x/2 if x is even; f(x) = 3x + 1 if x is odd. %H A078373 Jud McCranie, <a href="/A078373/b078373.txt">Table of n, a(n) for n = 1..40</a> %H A078373 J. C. Lagarias, <a href="http://www.cecm.sfu.ca/organics/papers/lagarias/paper/html/paper.html">The 3x+1 problem and its generalizations</a>, Amer. Math. Monthly, 92 (1985), 3-23. %H A078373 Carlos Rivera, <a href="http://www.primepuzzles.net/puzzles/puzz_634.htm">Puzzle 634. Primes in Collatz trajectory</a> %H A078373 Carlos Rivera, <a href="http://www.primepuzzles.net/puzzles/puzz_922.htm">Puzzle 922. Follow up to Puzzle 634</a> %e A078373 The sequence n, f(n), f(f(n)), ..., 1 for n = 7 is: 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, which has six prime terms, more prime terms than for any n < 7. Hence 7 sets a record and so belongs to the sequence. %t A078373 f[n_] := n/2 /; Mod[n, 2] == 0 f[n_] := 3 n + 1 /; Mod[n, 2] == 1 g[n_] := Module[{i, p}, i = n; p = 0; While[i > 1, If[PrimeQ[i], p = p + 1]; i = f[i]]; p]; high = 0; a = {}; For[j = 1, j <= 10^5, j++, k = g[j]; If[k > high, high = k; a = Append[a, j]]]; a %t A078373 (* Second program: *) %t A078373 With[{s = Array[Count[NestWhileList[If[EvenQ[#], #/2, 3 # + 1] &, #, # > 1 &], _?PrimeQ] &, 10^5]}, Map[FirstPosition[s, #][[1]] &, Union@ FoldList[Max, s]]] (* _Michael De Vlieger_, Apr 21 2018 *) %o A078373 (PARI) A078350(n)=my(s=isprime(n)); while(n>1, if(n%2, n=(3*n+1)/2, n/=2); s+=isprime(n)); s %o A078373 r=0; for(n=2,1e9, t=A078350(n); if(t>r, r=t; print1(n", "))) \\ _Charles R Greathouse IV_, Apr 28 2015 %Y A078373 A362958 gives the corresponding numbers of primes. %Y A078373 Cf. A055509, A181921. %K A078373 nonn %O A078373 1,1 %A A078373 _Joseph L. Pe_, Dec 24 2002 %E A078373 a(18)-a(30) from _Donovan Johnson_, Jul 02 2010 %E A078373 a(31)-a(33) from _Carlos Rivera_, Apr 15 2012