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).
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
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.
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
Extensions
Definition clarified by Jianing Song, Jun 22 2018