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.

Showing 1-4 of 4 results.

A094343 List of pairs of primes (p, q) with q - p = 4.

Original entry on oeis.org

3, 7, 7, 11, 13, 17, 19, 23, 37, 41, 43, 47, 67, 71, 79, 83, 97, 101, 103, 107, 109, 113, 127, 131, 163, 167, 193, 197, 223, 227, 229, 233, 277, 281, 307, 311, 313, 317, 349, 353, 379, 383, 397, 401, 439, 443, 457, 461, 463, 467, 487, 491, 499, 503, 613, 617, 643
Offset: 1

Views

Author

Gerard Schildberger, Jun 04 2004

Keywords

Comments

The two primes p and p+4 are not necessarily consecutive primes (for that, see A111980).
The pairs are listed in order, sorted by their smallest member. - N. J. A. Sloane, Dec 27 2019

Examples

			The pairs are (3,7), (7,11), (13,17), etc.
		

Crossrefs

Almost identical to A111980.
Union of A023200 and A046132.
Cf. twin primes (A001097).
See also A000040, A111981, A001097.
For a gap of 6 (which initially is very common) see A140546.

Programs

  • Mathematica
    Flatten[{#,#+4}&/@Select[Prime[Range[200]],PrimeQ[#+4]&]] (* Harvey P. Dale, Apr 13 2011 *)
  • PARI
    isok(n) = (isprime(n) && isprime(n+4)) || (isprime(n-4) && isprime(n)); \\ Michel Marcus, Aug 26 2013

Formula

a(2*n-1)=A023200(n). a(2*n)=A046132(n).

Extensions

Description was corrupted up during editing; correct description restored Aug 21 2005.
a(3) = 7 added by Vincenzo Librandi, May 06 2016

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 *)

A111980 Union of pairs of consecutive primes p, q with q-p = 4.

Original entry on oeis.org

7, 11, 13, 17, 19, 23, 37, 41, 43, 47, 67, 71, 79, 83, 97, 101, 103, 107, 109, 113, 127, 131, 163, 167, 193, 197, 223, 227, 229, 233, 277, 281, 307, 311, 313, 317, 349, 353, 379, 383, 397, 401, 439, 443, 457, 461, 463, 467, 487, 491, 499, 503, 613, 617, 643
Offset: 1

Views

Author

Ray Chandler, Aug 24 2005

Keywords

Crossrefs

Essentially the same as A094343.
Union of A029710 and A031505.
Cf. A140546.

Programs

  • Mathematica
    Flatten[Select[Partition[Prime[Range[200]],2,1],#[[2]]-#[[1]]==4&]]//Union (* Harvey P. Dale, Jul 09 2024 *)

A243012 Odd primes p such that neither p - 4 nor p + 4 is prime.

Original entry on oeis.org

5, 29, 31, 53, 59, 61, 73, 89, 137, 139, 149, 151, 157, 173, 179, 181, 191, 199, 211, 239, 241, 251, 257, 263, 269, 271, 283, 293, 331, 337, 347, 359, 367, 373, 389, 409, 419, 421, 431, 433, 449, 479, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 619
Offset: 1

Views

Author

Juri-Stepan Gerasimov, May 28 2014

Keywords

Examples

			5 is in this sequence because 5 is prime and neither 5 - 4 = 1 nor 5 + 4 = 9 is prime.
		

Crossrefs

Programs

  • Magma
    [p: p in PrimesUpTo(620) | not IsPrime(p-4) and not IsPrime(p+4)];
    
  • Mathematica
    Select[Prime[Range[125]], Not[PrimeQ[# - 4]] && Not[PrimeQ[# + 4]] &] (* Alonso del Arte, May 30 2014 *)
  • PARI
    select(n->!isprime(n-4) && !isprime(n+4), primes(200)) \\ Charles R Greathouse IV, May 29 2014
    
  • Sage
    [p for p in primes(5,700) if not is_prime(p-4) and not is_prime(p+4)] # Bruno Berselli, Jun 10 2014

Formula

a(n) ~ n log n. - Charles R Greathouse IV, May 29 2014
Showing 1-4 of 4 results.