%I #19 Dec 31 2022 15:22:43
%S 2,3,1531,19,631,37,41,13,670231,614333,11699,11,2447,3049,223,13,
%T 8353,2531,2203,241,3209,5023,52631,461,26723,3307
%N a(n) is the first prime p such that the average of the n-th powers of n consecutive primes starting with p is prime.
%C a(27) > 2*10^8. The 27 consecutive primes starting at a(27) must all be congruent (mod 3).
%C a(28) = 8677, a(29) = 33349, a(30) = 67103.
%C a(27) > 10^11. Up to 10^11, the longest runs of consecutive primes that are congruent (mod 3) are all of length 25: 21549657539, ..., 21549658079 (all == 2 (mod 3), 43553959717, ..., 43553960299 (all == 1 (mod 3)), and 55989913757, ..., 55989914177 (all == 2 (mod 3)). - _Jon E. Schoenfield_, Dec 26 2022
%e a(3) = 1531 because 1531, 1543 and 1549 are consecutive primes and (1531^3 + 1543^3 + 1549^3)/3 = 3659642149 is prime, and 1531 is the least prime that works.
%p g:= proc(n) local P,s,i;
%p P:= <seq(ithprime(i),i=1..n)>;
%p s:= add(P[i]^n,i=1..n)/n;
%p do
%p if s::integer and isprime(s) then return P[1] fi;
%p s:= s - P[1]^n/n;
%p P[1..-2] := P[2..-1]; P[n]:= nextprime(P[n]);
%p s:= s + P[n]^n/n;
%p od
%p end proc:
%p map(g, [$1..26]);
%o (Python)
%o from sympy import prime, isprime, nextprime, primerange
%o def a(n):
%o plst = list(primerange(2, prime(n)+1))
%o powsum = sum(p**n for p in plst)
%o while True:
%o q, r = divmod(powsum, n)
%o if r == 0 and isprime(q): return plst[0]
%o powsum -= plst[0]**n
%o plst = plst[1:] + [nextprime(plst[-1])]
%o powsum += plst[-1]**n
%o print([a(n) for n in range(1, 27)]) # _Michael S. Branicky_, Dec 27 2022
%Y Cf. A359322.
%K nonn,more
%O 1,1
%A _Robert Israel_, Dec 25 2022