[go: up one dir, main page]

login
A163847
Starting from a(1)=13, a(n+1) is the smallest prime > a(n) such that 2*a(n) - a(n+1) is also prime.
6
13, 19, 31, 43, 67, 73, 79, 97, 127, 151, 163, 199, 241, 271, 313, 349, 367, 397, 421, 433, 457, 541, 619, 631, 643, 673, 727, 811, 853, 877, 967, 997, 1087, 1123, 1129, 1171, 1213, 1297, 1303, 1327, 1423, 1447, 1471, 1483, 1543, 1597, 1627, 1657, 1693
OFFSET
1,1
COMMENTS
This is: select the 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).
It seems all these primes are in the class 1 (mod 6), that is, in A002476 as opposed to A007528.
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
Sequence in context: A182365 A069324 A040047 * A051644 A101408 A023252
KEYWORD
nonn
AUTHOR
EXTENSIONS
Definition and comment rephrased by R. J. Mathar, Aug 29 2009
STATUS
approved