OFFSET
1,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000 (terms 1..1000 from T. D. Noe)
EXAMPLE
a(2)=12 because between 4 and 9 there are two primes (5 and 7) with sum equal to 12.
MAPLE
a:=proc(n) local s, j: s:=0: for j from n^2 to (n+1)^2 do if isprime(j)=true then s:=s+j else s:=s: fi od end: seq(a(n), n=1..50); # Emeric Deutsch, Jul 01 2005
MATHEMATICA
f[n_] := Plus @@ Prime[ Range[PrimePi[n^2] + 1, PrimePi[(n + 1)^2]]]; Table[ f[n], {n, 44}] (* Robert G. Wilson v, Jul 01 2005 *)
PROG
(PARI) A108314(n)={r=0; forprime(i=n^2+1, (n+1)^2-1, r=r+i); r} \\ Michael B. Porter, Oct 14 2009
(Python)
from sympy import sieve
def a(n): return sum(p for p in sieve.primerange(n**2, (n+1)**2))
print([a(n) for n in range(1, 46)]) # Michael S. Branicky, Jul 29 2021
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Giovanni Teofilatto, Jun 30 2005
EXTENSIONS
Edited, corrected and extended by Emeric Deutsch, Robert G. Wilson v and Rick L. Shepherd, Jul 01 2005
STATUS
approved