cp's OEIS Frontend

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.

A163846 Starting from a(1)=5, a(n+1) is the smallest prime > a(n) such that 2*a(n)-a(n+1) is also prime.

Original entry on oeis.org

5, 7, 11, 17, 23, 29, 41, 53, 59, 71, 83, 107, 113, 137, 167, 197, 227, 257, 263, 269, 281, 293, 317, 353, 359, 401, 419, 449, 467, 491, 503, 557, 593, 599, 641, 683, 719, 761, 821, 881, 941, 953, 977, 983, 1013, 1049, 1151, 1193, 1223, 1229, 1277, 1361, 1433
Offset: 1

Views

Author

Keywords

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)

Examples

			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.
		

Crossrefs

Programs

  • 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 *)

Extensions

Edited by R. J. Mathar, Aug 29 2009