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.

A305558 If (p1,p2) is the n-th twin prime pair and p the prime before p1 and q the prime after p2 then a(n) = p + q - (p1 + p2).

Original entry on oeis.org

1, 2, 0, 0, 0, 0, 0, 2, 0, 0, 4, -4, 4, -6, 8, 0, 4, 0, 6, 0, -6, 0, -4, 0, 6, 0, 0, 8, -6, 6, -2, -6, 6, 0, 0, 4, -4, 0, -4, 0, -12, 0, -14, 0, 0, -6, 0, 2, -6, 0, -2, 0, 20, 6, -2, 8, 0, 6, -2, 6, 0, 0, -8, 6, 4, -10, 6, -12, -12, 10, 0, 2, 0, 4, -6, 0, 2, 0, -6, 12, 22, -18, 6, 8, -18, 8, -22, 6, -2, 6, 0, 0, 18, -6
Offset: 1

Views

Author

Dimitris Valianatos, Jun 21 2018

Keywords

Examples

			For n = 8, the 8th prime pair is (71, 73), the prime before 71 is 67 and prime after 73 is 79. So a(8) = 67 + 79 - 71 - 73 = 2.
		

Crossrefs

Programs

  • Mathematica
    Map[#1 + #4 - (#2 + #3) & @@ # &, Select[Partition[Prime@ Range[500], 4, 1], And[#3 - #2 == 2] & @@ # &]] (* Michael De Vlieger, Jun 30 2018 *)
  • PARI
    {
    print1(2+7-(5+3)", ");
    forstep(n=6,100,6,
            if(isprime(n-1)&&isprime(n+1),
               a=precprime(n-2);b=nextprime(n+2);
               print1(a+b-2*n", ")
              )
           )
    }

Formula

a(n) = A000040(A029707(n)-1) + A000040(A107770(n)+1) - (A001359(n) + A006512(n)). - Jianing Song, Jun 22 2018

Extensions

Definition clarified by Jianing Song, Jun 22 2018