OFFSET
1,1
COMMENTS
a(27) > 2*10^8. The 27 consecutive primes starting at a(27) must all be congruent (mod 3).
a(28) = 8677, a(29) = 33349, a(30) = 67103.
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
EXAMPLE
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.
MAPLE
g:= proc(n) local P, s, i;
P:= <seq(ithprime(i), i=1..n)>;
s:= add(P[i]^n, i=1..n)/n;
do
if s::integer and isprime(s) then return P[1] fi;
s:= s - P[1]^n/n;
P[1..-2] := P[2..-1]; P[n]:= nextprime(P[n]);
s:= s + P[n]^n/n;
od
end proc:
map(g, [$1..26]);
PROG
(Python)
from sympy import prime, isprime, nextprime, primerange
def a(n):
plst = list(primerange(2, prime(n)+1))
powsum = sum(p**n for p in plst)
while True:
q, r = divmod(powsum, n)
if r == 0 and isprime(q): return plst[0]
powsum -= plst[0]**n
plst = plst[1:] + [nextprime(plst[-1])]
powsum += plst[-1]**n
print([a(n) for n in range(1, 27)]) # Michael S. Branicky, Dec 27 2022
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Robert Israel, Dec 25 2022
STATUS
approved