OFFSET
1,1
COMMENTS
This sequence is a subsequence of A014574 (average of twin prime pairs).
LINKS
Karl V. Keller, Jr., Table of n, a(n) for n = 1..500000
Eric Weisstein's World of Mathematics, Twin Primes
EXAMPLE
For n=12: 7, 11, 13, 17 are four consecutive primes with 13 = 11 + 2 and (7+17)/2 = 12.
For n=18: 13, 17, 19, 23 are four consecutive primes with 19 = 17 + 2 and (13+23)/2 = 18.
MATHEMATICA
Select[Prime[Range[10^3]], PrimeQ[#+2]&&2*#+2==NextPrime[#, -1]+NextPrime[#, 2]&]+1 (* Ivan N. Ianakiev, Apr 23 2015 *)
Select[Partition[Prime[Range[700]], 4, 1], #[[3]]-#[[2]]==2&&(#[[1]]+#[[4]])/2 == (#[[2]]+#[[3]])/2&][[All, 2]]+1 (* Harvey P. Dale, May 06 2022 *)
PROG
(Python)
from sympy import isprime, prevprime, nextprime
for i in range(5, 12001, 2):
..if isprime(i) and isprime(i+2):
....if prevprime(i)+nextprime(i, 2) == 2*(i+1): print(i+1, end=', ')
(PARI) lista(nn) = {forprime(p=3, nn, if (isprime(p+2), if (precprime(p-1)+nextprime(p+3) == 2*(p+1), print1(p+1, ", ")); ); ); } \\ Michel Marcus, Apr 12 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Karl V. Keller, Jr., Apr 09 2015
STATUS
approved