%I #32 May 06 2022 11:41:24
%S 12,18,30,42,60,102,108,228,270,312,420,462,570,600,858,882,1050,1092,
%T 1230,1290,1302,1428,1488,1620,1872,1998,2028,2340,2550,2688,2730,
%U 3390,3462,3540,3582,4020,4230,4242,4272,4338,4518,4650,4788
%N Numbers n such that n is both the average of some twin prime pair p, q (q = p+2) (i.e., n = p+1 = q-1) and is also the average of the prime before p and the prime after q.
%C This sequence is a subsequence of A014574 (average of twin prime pairs).
%H Karl V. Keller, Jr., <a href="/A256753/b256753.txt">Table of n, a(n) for n = 1..500000</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/TwinPrimes.html">Twin Primes</a>
%e For n=12: 7, 11, 13, 17 are four consecutive primes with 13 = 11 + 2 and (7+17)/2 = 12.
%e For n=18: 13, 17, 19, 23 are four consecutive primes with 19 = 17 + 2 and (13+23)/2 = 18.
%t Select[Prime[Range[10^3]],PrimeQ[#+2]&&2*#+2==NextPrime[#,-1]+NextPrime[#,2]&]+1 (* _Ivan N. Ianakiev_, Apr 23 2015 *)
%t 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 *)
%o (Python)
%o from sympy import isprime,prevprime,nextprime
%o for i in range(5,12001,2):
%o ..if isprime(i) and isprime(i+2):
%o ....if prevprime(i)+nextprime(i,2) == 2*(i+1): print(i+1,end=', ')
%o (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
%Y Cf. A077800 (twin primes), A014574.
%K nonn
%O 1,1
%A _Karl V. Keller, Jr._, Apr 09 2015
|