login
Numbers which are the average of two consecutive odd primes (A024675) together with primes which are the average of the previous prime and the following prime (A006562).
9

%I #45 Feb 02 2019 04:25:08

%S 4,5,6,9,12,15,18,21,26,30,34,39,42,45,50,53,56,60,64,69,72,76,81,86,

%T 93,99,102,105,108,111,120,129,134,138,144,150,154,157,160,165,170,

%U 173,176,180,186,192,195,198,205,211,217,225,228,231,236,240,246,254,257,260

%N Numbers which are the average of two consecutive odd primes (A024675) together with primes which are the average of the previous prime and the following prime (A006562).

%C Numbers n such that prevprime(n) + nextprime(n) = 2n. - _Wesley Ivan Hurt_, May 13 2017

%H Robert Israel, <a href="/A145025/b145025.txt">Table of n, a(n) for n = 1..10000</a>

%p Primes:= select(isprime, [seq(i,i=3..1000,2)]):

%p nprimes:= nops(Primes):

%p A024675:= {seq((Primes[i]+Primes[i+1])/2, i=1..nprimes-1)}:

%p L:= Primes[1..-3]+Primes[3..-1]:

%p A006562:=zip((s,t) -> if 2*s=t then s else NULL fi, Primes[2..-2],L):

%p sort(convert(convert(A006562,set) union A024675, list)); # _Robert Israel_, Nov 20 2016

%t Union[Select[Map[Mean@ {First@ #, Last@ #} &, Partition[#, 3, 1]], PrimeQ], Map[Mean, Partition[#, 2, 1]]] &@ Prime@ Range[2, 56] (* _Michael De Vlieger_, Jan 31 2019 *)

%o (PARI) for(n=2,999,n-precprime(n-1)==nextprime(n+1)-n&&print1(n",")) \\ _M. F. Hasler_, Jun 01 2013

%Y Equals A024675 U A006562. - _M. F. Hasler_, Jun 01 2013

%K nonn

%O 1,1

%A _Vladimir Joseph Stephan Orlovsky_, Sep 29 2008

%E Entry revised by _N. J. A. Sloane_, Mar 24 2017, replacing old definition with definition from _M. F. Hasler_