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.
%I A163847 #21 Aug 09 2023 13:25:14 %S A163847 13,19,31,43,67,73,79,97,127,151,163,199,241,271,313,349,367,397,421, %T A163847 433,457,541,619,631,643,673,727,811,853,877,967,997,1087,1123,1129, %U A163847 1171,1213,1297,1303,1327,1423,1447,1471,1483,1543,1597,1627,1657,1693 %N 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. %C A163847 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). %C A163847 It seems all these primes are in the class 1 (mod 6), that is, in A002476 as opposed to A007528. %H A163847 Zhi-Wei Sun, <a href="/A163847/b163847.txt">Table of n, a(n) for n = 1..10000</a> %H A163847 Zhi-Wei Sun, <a href="http://arxiv.org/abs/1211.1588">Conjectures involving primes and quadratic forms</a>, arXiv:1211.1588. %e A163847 For a(2), the first candidate is the prime 17=13+4, which is not selected because 13-4=9 is not prime. %e A163847 The next larger candidate is the prime 13+6=19, which is selected as a(2) because 13-6=7 is also prime. %e A163847 For a(3) the first candidate is the prime 19+4=23, which is not selected because 19-4=15 is not prime. %e A163847 The next candidate is the prime 19+10=29, which is not selected because the 19-10=9 is not prime. %e A163847 The next larger candidate, the prime 19+12=31 is selected as a(3), because 19-12=7 is prime. %p A163847 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: %p A163847 seq(A163847(n),n=1..80) ; # _R. J. Mathar_, Aug 29 2009 %t A163847 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 %t A163847 (* Second program: *) %t A163847 k=6 %t A163847 n=1 %t A163847 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 *) %t A163847 sp[p_]:=Module[{p1=NextPrime[p]},While[!PrimeQ[2p-p1],p1=NextPrime[p1]];p1]; NestList[ sp,13,50] (* _Harvey P. Dale_, Aug 09 2023 *) %o A163847 (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 %Y A163847 Cf. A163846, A222532. %K A163847 nonn %O A163847 1,1 %A A163847 _Vladimir Joseph Stephan Orlovsky_, Aug 05 2009 %E A163847 Definition and comment rephrased by _R. J. Mathar_, Aug 29 2009