%I #27 Jun 07 2023 09:44:48
%S 2,3,7,19,47,73,113,199,283,467,661,887,1129,1327,1627,2803,3947,4297,
%T 5881,6379,7043,9949,10343,13187,15823,18461,24137,33647,34763,37663,
%U 42863,43067,59753,59797,82619,96017,102679,129643,130699,142237,155893,187477,194119
%N "Convex" primes: extremal primes in the sense of Tutaj.
%C See Tutaj (2014) for the precise definition.
%H Rémy Sigrist, <a href="/A246033/b246033.txt">Table of n, a(n) for n = 1..500</a>
%H Nathan McNew, <a href="http://dx.doi.org/10.1080/10586458.2016.115518">The Most Frequent Values of the Largest Prime Divisor Function</a>, Exper. Math., 2017, Vol. 26, No. 2, 210-224; also <a href="http://arxiv.org/abs/1504.05985">arXiv:1504.05985 [math.NT]</a>, 2015.
%H Carl Pomerance, <a href="https://doi.org/10.1090/S0025-5718-1979-0514836-7">The Prime Number Graph</a>, Mathematics of Computations, Volume 33, 145, January 1979, pages 399-408.
%H Edward Tutaj, <a href="http://arxiv.org/abs/1408.3609">Prime numbers with a certain extremal type property</a>, arXiv:1408.3609 [math.NT], 2014.
%p plist := [2,3] ;
%p nlist := [1,2] ;
%p p := 5 ;
%p for n from 3 to 100000 do # experimental upper limit!
%p plist := [op(plist),p] ;
%p nlist := [op(nlist),n] ;
%p doflat := true ;
%p while doflat do
%p doflat := false ;
%p for nrew from nops(nlist)-1 to 2 by -1 do
%p slopold := (nlist[nrew]-nlist[nrew-1])/(plist[nrew]-plist[nrew-1]) ;
%p slop := (nlist[nrew+1]-nlist[nrew])/(plist[nrew+1]-plist[nrew]) ;
%p if slop >= slopold then
%p plist := subsop(nrew=NULL,plist) ;
%p nlist := subsop(nrew=NULL,nlist) ;
%p doflat := true ;
%p end if;
%p end do:
%p end do:
%p print(plist) ;
%p p := nextprime(p) ;
%p end do: # _R. J. Mathar_, Jul 28 2017
%t terms = 50; nmax0 = 25000; dnmax = 1000; Clear[f];
%t f[nmax_] := f[nmax] = Module[{}, plist = {2, 3}; nlist = {1, 2}; p = 5;
%t For[n = 3, n <= nmax, n++,
%t plist = Append[plist, p];
%t nlist = Append[nlist, n]; doflat = True;
%t While[doflat, doflat = False;
%t For[nrew = Length[nlist]-1, nrew >= 2, nrew--, slopold = (nlist[[nrew]] - nlist[[nrew-1]])/(plist[[nrew]] - plist[[nrew-1]]); slop = (nlist[[nrew+1]] - nlist[[nrew]])/(plist[[nrew+1]] - plist[[nrew]]); If [slop >= slopold, plist [[nrew]] = Nothing nlist[[nrew]] = Nothing; doflat = True]]
%t ]; p = NextPrime[p]
%t ]; PadRight[plist, terms]
%t ];
%t f[nmax = nmax0]; f[nmax = nmax + dnmax];
%t While[Print[nmax]; f[nmax][[1 ;; terms]] != f[nmax - dnmax][[1 ;; terms]], nmax = nmax + dnmax];
%t f[nmax] (* _Jean-François Alcover_, Nov 01 2018, from _R. J. Mathar_'s Maple code *)
%Y A different notion of convex prime is mentioned in A167844.
%K nonn
%O 1,1
%A _Michel Marcus_ and _N. J. A. Sloane_, Aug 18 2014
%E a(14) corrected by Edward Tutaj and _Charles R Greathouse IV_, Nov 27 2014
%E Primes beyond 33647 from _R. J. Mathar_, Jul 28 2017