A256753 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.
12, 18, 30, 42, 60, 102, 108, 228, 270, 312, 420, 462, 570, 600, 858, 882, 1050, 1092, 1230, 1290, 1302, 1428, 1488, 1620, 1872, 1998, 2028, 2340, 2550, 2688, 2730, 3390, 3462, 3540, 3582, 4020, 4230, 4242, 4272, 4338, 4518, 4650, 4788
Offset: 1
Keywords
Examples
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.
Links
- Karl V. Keller, Jr., Table of n, a(n) for n = 1..500000
- Eric Weisstein's World of Mathematics, Twin Primes
Programs
-
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 *)
-
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
-
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=', ')
Comments