%I #38 Sep 03 2016 11:28:43
%S 30,42,60,105,144,165,192,228,270,312,462,570,600,858,870,882,1026,
%T 1092,1230,1254,1290,1302,1428,1482,1620,1878,1998,2028,2340,2550,
%U 2688,2730,2760,3345,3540,3582,3627,3795,3885,4020,4338,4500,4518,4650,4755,4788,4866
%N Arithmetic mean of two consecutive twin primes that is also the arithmetic mean of two consecutive non-twin primes.
%C Intersection of A162734 (averages of consecutive non-twin primes) and A163656 (averages of consecutive twin primes).
%C a(n)/3 are: 10, 14, 20, 35, 48, ...
%H Jens Kruse Andersen, <a href="/A244066/b244066.txt">Table of n, a(n) for n = 1..10000</a>
%e 30 is in this sequence because it is the arithmetic mean of 29 and 31, consecutive terms of A001097, as well as of 23 and 37, consecutive terms of A007510.
%t Module[{prs=Prime[Range[800]],tp,nt},tp=Flatten[Select[Partition[ prs,2,1],#[[2]]- #[[1]]==2&]];nt=Complement[prs,tp];Select[Tally[ Join[ Mean/@ Partition[tp,2,1],Mean/@Partition[nt,2,1]]],#[[2]]==2&][[All,1]]] (* _Harvey P. Dale_, Sep 03 2016 *)
%o (PARI)
%o a244066(pmax) = {
%o my(tp=[], m, j, k, s=[]);
%o forprime(p=2, pmax, if(isprime(p-2) || isprime(p+2), tp=concat(tp, p)));
%o for(i=1, #tp-1,
%o m=(tp[i]+tp[i+1])\2;
%o j=1; while(!(isprime(m+j) && !isprime(m+j-2) && !isprime(m+j+2)), j++);
%o k=1; while(!(isprime(m-k) && !isprime(m-k-2) && !isprime(m-k+2)), k++);
%o if(j==k, s=concat(s, m))
%o );
%o s
%o }
%o a244066(5000) \\ _Colin Barker_, Jul 18 2014
%Y Cf. A014574, A007510. Subsequence of A163656.
%K nonn
%O 1,1
%A _Juri-Stepan Gerasimov_, Jun 19 2014
%E Definition corrected by _Antti Karttunen_, Jun 21 2014.
%E Terms and definition corrected by _Colin Barker_, Jul 18 2014
|