OFFSET
1,1
COMMENTS
This is: select the smallest prime a(n+1) = a(n)+d such that at a(n)-d is another prime at the same distance to but at the opposite side of a(n).
From Zhi-Wei Sun, Feb 25 2013: (Start)
By induction, a(n)==2 (mod 3) for all n>2.
For a prime p>3 define g(p) as the least prime q>p such that 2p-q is also prime. Construct a simple (undirected) graph G as follows: The vertex set is the set of all primes greater than 3, and there is an edge connecting the vertices p and q>p if and only if g(p)=q.
Conjecture: The graph G constructed above consists of exactly two trees: one containing 7 and all odd primes congruent to 2 modulo 3, and another one containing all primes congruent to 1 modulo 3 except 7. (End)
LINKS
Zhi-Wei Sun, Table of n, a(n) for n = 1..10000
Zhi-Wei Sun, Conjectures involving primes and quadratic forms, arXiv:1211.1588.
EXAMPLE
The first candidate for a(2) is the prime 5+2=7, which is selected since 5-2=3 is also prime.
The first candidate for a(3) is the prime 7+4=11, which is selected since 7-4=3 is also prime.
The first candidate for a(4) is the prime 11+2=13, which is not selected since 11-2=9 is composite.
The second candidate for a(4) is the prime 11+4=17, which is selected since 11-4=7 is prime.
MATHEMATICA
DeltaPrimePrevNext[n_]:=Module[{d, k1, k2}, k1=n-1; k2=n+1; While[ !PrimeQ[k1] || !PrimeQ[k2], k2++; k1-- ]; d=k2-n]; lst={}; p=5; Do[If[p-DeltaPrimePrevNext[p]>1, AppendTo[lst, p]; p=p+DeltaPrimePrevNext[p]], {n, 6!}]; lst
k=3
n=1
Do[If[m==3, Print[n, " ", 5]]; If[m==k, n=n+1; Do[If[PrimeQ[2Prime[m]-Prime[j]]==True, k=j; Print[n, " ", Prime[j]]; Goto[aa]], {j, m+1, PrimePi[2Prime[m]]}]]; Label[aa]; Continue, {m, 3, 1000}] (* Zhi-Wei Sun, Feb 25 2013 *)
np[n_]:=Module[{nxt=NextPrime[n]}, While[!PrimeQ[2n-nxt], nxt=NextPrime[nxt]]; nxt]; NestList[np, 5, 60] (* Harvey P. Dale, Feb 28 2013 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Joseph Stephan Orlovsky, Aug 05 2009
EXTENSIONS
Edited by R. J. Mathar, Aug 29 2009
STATUS
approved