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.

A087243 a(n) = n + A087242(n) or a(n)=0 if A087242(n)=0; the primes arising as n + A087242(n).

Original entry on oeis.org

3, 5, 5, 7, 7, 11, 0, 11, 11, 13, 13, 17, 0, 17, 17, 19, 19, 23, 0, 23, 23, 29, 0, 29, 0, 29, 29, 31, 31, 37, 0, 37, 0, 37, 37, 41, 0, 41, 41, 43, 43, 47, 0, 47, 47, 53, 0, 53, 0, 53, 53, 59, 0, 59, 0, 59, 59, 61, 61, 67, 0, 67, 0, 67, 67, 71, 0, 71, 71, 73, 73, 79, 0, 79, 0, 79, 79, 83, 0
Offset: 1

Views

Author

Labos Elemer, Sep 04 2003

Keywords

Comments

If n is odd, a(n) is either n+2 (if n+2 is prime) or 0; if n is even, a(n) is the least prime p such that p-n is prime. Polignac's conjecture implies that such a prime exists. - Robert Israel, Sep 29 2014

Examples

			a(n)=0, i.e., no solution exists if n is a special prime, namely n is not a lesser twin prime; e.g., if n=7, then neither 7+2=9 nor 7+(oddprime) is a prime, thus no p prime exists such that 7+p is also a prime.
If n is a lesser twin prime then a(n)=2 is a solution because n+a(n) = n+2 = greater twin prime satisfying the condition.
		

Crossrefs

Cf. A087242.

Programs

  • Maple
    N:= 1000: # to get the first N terms
    nToDo:= floor(N/2): OddPrimes[1]:= 3: A[1]:= 3:
    for i from 1 to floor(N/2) do A[2*i+1]:= 0 od:
    for j from 2 while nToDo > 0 do
       OddPrimes[j]:= nextprime(OddPrimes[j-1]);
       A[OddPrimes[j]-2]:= OddPrimes[j];
       for i from 1 to j-1 do
          d:= OddPrimes[j] - OddPrimes[i];
          if d <= N and not assigned(A[d]) then
             A[d]:= OddPrimes[j];
             nToDo:= nToDo-1;
          fi
        od
    od:
    seq(A[j], j=1..N); # Robert Israel, Sep 29 2014
  • PARI
    a(n) = {if (n % 2, if (isprime(n+2), p = 2, p = 0);, p = 2; while (!isprime(n+p), p = nextprime(p+1));); if (p, n + p, 0);} \\ Michel Marcus, Dec 26 2013

Formula

a(n) = n+Min{x prime; n+x is prime} or a(n)=0 if Min{} does not exist.

Extensions

Some corrections by Michel Marcus, Dec 26 2013