|
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
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
|
|
LINKS
|
|
|
FORMULA
|
a(n) = n+Min{x prime; n+x is prime} or a(n)=0 if Min{} does not exist.
|
|
EXAMPLE
|
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.
|
|
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:
|
|
PROG
|
(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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|