login
a(n) is the first prime p such that the average of p and the next n-1 primes congruent to p (mod n) is a prime.
1

%I #8 Aug 26 2022 11:22:39

%S 5,17,11,19,11,7,5,3,3,13,3,23,7,3,29,5,3,127,17,7,7,7,31,79,5,17,3,

%T 17,37,7,23,5,3,5,17,17,11,3,5,107,23,23,7,7,11,11,5,37,11,7,3,19,37,

%U 47,37,101,11,71,5,151,13,23,3,23,3,71,11,11,29,13,3,7,97,5,47,17,3,19,11,83,17,11

%N a(n) is the first prime p such that the average of p and the next n-1 primes congruent to p (mod n) is a prime.

%H Robert Israel, <a href="/A356403/b356403.txt">Table of n, a(n) for n = 3..10000</a>

%e a(4) = 19 because 19 is prime, the next 3 primes == 19 (mod 4) are 23, 31 and 43, and (19+23+31+43)/4 = 29 is prime.

%p f:= proc(n) local p,q,k,s,count;

%p p:= 1;

%p do

%p p:= nextprime(p);

%p if n mod p = 0 then next fi;

%p s:= p; count:= 1;

%p for q from p+n by n while count < n do

%p if isprime(q) then s:= s+q; count:= count+1 fi

%p od;

%p if isprime(s/n) then return p fi

%p od

%p end proc:

%p map(f, [$3..100]);

%Y Cf. A356383.

%K nonn

%O 3,1

%A _J. M. Bergot_ and _Robert Israel_, Aug 05 2022