cp's OEIS Frontend

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.

A246033 "Convex" primes: extremal primes in the sense of Tutaj.

Original entry on oeis.org

2, 3, 7, 19, 47, 73, 113, 199, 283, 467, 661, 887, 1129, 1327, 1627, 2803, 3947, 4297, 5881, 6379, 7043, 9949, 10343, 13187, 15823, 18461, 24137, 33647, 34763, 37663, 42863, 43067, 59753, 59797, 82619, 96017, 102679, 129643, 130699, 142237, 155893, 187477, 194119
Offset: 1

Views

Author

Michel Marcus and N. J. A. Sloane, Aug 18 2014

Keywords

Comments

See Tutaj (2014) for the precise definition.

Crossrefs

A different notion of convex prime is mentioned in A167844.

Programs

  • Maple
    plist := [2,3] ;
    nlist := [1,2] ;
    p := 5 ;
    for n from 3 to 100000 do # experimental upper limit!
        plist := [op(plist),p] ;
        nlist := [op(nlist),n] ;
        doflat := true ;
        while doflat do
            doflat := false ;
            for nrew from nops(nlist)-1 to 2 by -1 do
                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 then
                    plist := subsop(nrew=NULL,plist) ;
                    nlist := subsop(nrew=NULL,nlist) ;
                    doflat := true ;
                end if;
            end do:
        end do:
        print(plist) ;
        p := nextprime(p) ;
    end do: # R. J. Mathar, Jul 28 2017
  • Mathematica
    terms = 50; nmax0 = 25000; dnmax = 1000; Clear[f];
    f[nmax_] := f[nmax] = Module[{}, plist = {2, 3}; nlist = {1, 2}; p = 5;
    For[n = 3, n <= nmax, n++,
    plist = Append[plist, p];
    nlist = Append[nlist, n]; doflat = True;
    While[doflat, doflat = False;
    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]]
    ]; p = NextPrime[p]
    ]; PadRight[plist, terms]
    ];
    f[nmax = nmax0]; f[nmax = nmax + dnmax];
    While[Print[nmax]; f[nmax][[1 ;; terms]] != f[nmax - dnmax][[1 ;; terms]], nmax = nmax + dnmax];
    f[nmax] (* Jean-François Alcover, Nov 01 2018, from R. J. Mathar's Maple code *)

Extensions

a(14) corrected by Edward Tutaj and Charles R Greathouse IV, Nov 27 2014
Primes beyond 33647 from R. J. Mathar, Jul 28 2017