login
Numbers which are either prime or the average of consecutive odd primes.
7

%I #20 Oct 31 2020 17:30:47

%S 2,3,4,5,6,7,9,11,12,13,15,17,18,19,21,23,26,29,30,31,34,37,39,41,42,

%T 43,45,47,50,53,56,59,60,61,64,67,69,71,72,73,76,79,81,83,86,89,93,97,

%U 99,101,102,103,105,107,108,109,111,113,120,127,129,131,134,137,138

%N Numbers which are either prime or the average of consecutive odd primes.

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

%H Harry J. Smith, <a href="/A063934/b063934.txt">Table of n, a(n) for n = 1..1000</a>

%F For n >= 1: a(2n)=A000040(n+1); a(2n+1)=(A000040(n+1)+A000040(n+2))/2 =A024675(n).

%e 7 is prime, 9 is the average of 7 and 11, 11 is prime, 12 is the average of 11 and 13; so 7, 9, 11 and 13 are in the sequence.

%t Function[p, Union@ Join[p, Rest@ Map[Mean, Partition[p, 2, 1]]]]@ Prime@ Range@ 34 (* _Michael De Vlieger_, May 13 2017 *)

%o (PARI) { for (n=1, 1000, if (n==1, a=2; p=3, if (n%2, a=(q + p=nextprime(q + 1))/2, a=q=p)); write("b063934.txt", n, " ", a) ) } \\ _Harry J. Smith_, Sep 03 2009

%Y Cf. A063932, A063933.

%K nonn

%O 1,1

%A _Henry Bottomley_, Aug 21 2001