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.

A136207 Primes p such that p-6 or p+6 is prime.

Original entry on oeis.org

5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 131, 137, 151, 157, 163, 167, 173, 179, 191, 193, 197, 199, 223, 227, 229, 233, 239, 251, 257, 263, 269, 271, 277, 283, 307, 311, 313, 317, 331, 337
Offset: 1

Views

Author

Carlos Alves, Dec 21 2007

Keywords

Comments

Either or both of (p-6) and (p+6) is/are prime. - Harvey P. Dale, Jun 22 2019

Crossrefs

Cf. A023201, A046117, A140546 (complement).

Programs

  • Maple
    isA136207 := proc(n)
        if isprime(n) then
            if isprime(n+6) or isprime(n-6) then
                true;
            else
                false;
            end if;
        else
            false ;
        end if;
    end proc:
    A136207 := proc(n)
        option remember;
        local a;
        if n = 1 then
            5 ;
        else
            a := nextprime(procname(n-1)) ;
            while true do
                if isA136207(a) then
                    return a;
                else
                    a := nextprime(a) ;
                end if;
            end do:
        end if;
    end proc:
    seq(A136207(n),n=1..80) ; # R. J. Mathar, Jun 10 2024
  • Mathematica
    dd = 6; DistancePrimesQ1 = (PrimeQ[ # ] && PrimeQ[ # + dd]) &; DistancePrimesQ2 = (PrimeQ[ # ] && PrimeQ[ # - dd] && (# > dd)) &; DistancePrimesQQ = (DistancePrimesQ1[ # ] || DistancePrimesQ2[ # ]) &; DistancePrimes = Select[Range[ # ], DistancePrimesQQ] &; DistancePrimes[1000]
    Alternative by Lei Zhou:
    p = 3; Table[While[p = NextPrime[p]; ! (PrimeQ[p - 6] || PrimeQ[p + 6])]; p, {n, 1, 100}]
    Select[Prime[Range[3,100]],AnyTrue[#+{6,-6},PrimeQ]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jun 22 2019 *)