OFFSET
1,1
COMMENTS
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
For a(2), the first candidate is the prime 17=13+4, which is not selected because 13-4=9 is not prime.
The next larger candidate is the prime 13+6=19, which is selected as a(2) because 13-6=7 is also prime.
For a(3) the first candidate is the prime 19+4=23, which is not selected because 19-4=15 is not prime.
The next candidate is the prime 19+10=29, which is not selected because the 19-10=9 is not prime.
The next larger candidate, the prime 19+12=31 is selected as a(3), because 19-12=7 is prime.
MAPLE
A163847 := proc(n) option remember; if n = 1 then 13; else for a from procname(n-1)+2 by 2 do if isprime(a) and isprime( 2*procname(n-1)-a) then RETURN(a) ; fi; od: fi; end:
seq(A163847(n), n=1..80) ; # R. J. Mathar, Aug 29 2009
MATHEMATICA
DeltaPrimePrevNext[n_]:=Module[{d, k1, k2}, k1=n-1; k2=n+1; While[ !PrimeQ[k1] || !PrimeQ[k2], k2++; k1-- ]; d=k2-n]; lst13={}; p=13; Do[If[p-DeltaPrimePrevNext[p]>1, AppendTo[lst13, p]; p=p+DeltaPrimePrevNext[p]], {n, 7!}]; lst13
(* Second program: *)
k=6
n=1
Do[If[m==6, Print[n, " ", 13]]; 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, 6, 1000}] (* Zhi-Wei Sun, Feb 25 2013 *)
sp[p_]:=Module[{p1=NextPrime[p]}, While[!PrimeQ[2p-p1], p1=NextPrime[p1]]; p1]; NestList[ sp, 13, 50] (* Harvey P. Dale, Aug 09 2023 *)
PROG
(PARI) first(n) = { my(res = vector(n)); res[1] = 13; for(x=2, n, forprime(p=res[x-1]+1, , if(ispseudoprime(2*res[x-1] - p), res[x]=p; break()))); res; } \\ Iain Fox, Nov 18 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Joseph Stephan Orlovsky, Aug 05 2009
EXTENSIONS
Definition and comment rephrased by R. J. Mathar, Aug 29 2009
STATUS
approved