login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A359322 a(n) is the first prime p such that the average of the squares of n consecutive primes starting with p is prime. 3
3, 7, 7, 1627, 83, 7, 23, 7, 19, 17, 73, 281, 179, 257, 5, 43, 73, 43, 19, 67, 911, 193, 7, 1613, 139, 383, 7, 719, 113, 967, 31, 19, 211, 769, 149, 173, 13, 13, 59, 137, 23, 47, 89, 607, 61, 127, 61, 317, 1049, 1277, 547, 281, 317, 4157, 199, 107, 373, 149, 229, 367, 1489, 643, 563, 587, 263 (list; graph; refs; listen; history; text; internal format)
OFFSET
2,1
COMMENTS
Suggested in an email by J. M. Bergot.
LINKS
EXAMPLE
a(3) = 7 because 7, 11, 13 are 3 consecutive primes and (7^2 + 11^2 + 13^2)/3 = 113 is prime, and 7 is the least prime that works.
MAPLE
f:= proc(n) local P, s, i;
P:= <seq(ithprime(i), i=1..n)>;
s:= add(P[i]^2, i=1..n)/n;
do
if s::integer and isprime(s) then return P[1] fi;
s:= s - P[1]^2/n;
P[1..-2] := P[2..-1]; P[n]:= nextprime(P[n]);
s:= s + P[n]^2/n;
od
end proc:
map(f, [$2..70]);
PROG
(Python)
from sympy import prime, isprime, nextprime, primerange
def a(n):
plst = list(primerange(2, prime(n)+1))
powsum = sum(p**2 for p in plst)
while True:
q, r = divmod(powsum, n)
if r == 0 and isprime(q): return plst[0]
powsum -= plst[0]**2
plst = plst[1:] + [nextprime(plst[-1])]
powsum += plst[-1]**2
print([a(n) for n in range(2, 67)]) # Michael S. Branicky, Dec 29 2022
CROSSREFS
Sequence in context: A336719 A272981 A086839 * A316258 A258405 A064208
KEYWORD
nonn
AUTHOR
Robert Israel, Dec 25 2022
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 14 05:41 EDT 2024. Contains 375146 sequences. (Running on oeis4.)