OFFSET
1,8
COMMENTS
Conjecture: The partial sums of this sequence are greater than or equal to zero. This means that the squares of the prime numbers are smaller than the average of the previous and the next prime number most of the time.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = (nextprime(prime(n)^2) + precprime(prime(n)^2)) / 2 - prime(n)^2.
EXAMPLE
For n = 10 prime(10)^2 = 29^2 = 841. The previous prime of 841 is 839 and the next 853. The average of 839 and 853 is (839 + 853)/2 = 846. So a(10) = 846 - 841 = 5.
MAPLE
f:= p -> (nextprime(p^2) + prevprime(p^2))/2 - p^2:
map(f, [seq(ithprime(i), i=1..100)]); # Robert Israel, Nov 24 2024
MATHEMATICA
Array[(Total@ NextPrime[#, {-1, 1}])/2 - # &[Prime[#]^2] &, 73] (* Michael De Vlieger, Dec 11 2020 *)
PROG
(PARI) forprime(n = 2, 370, print1((nextprime(n^2) + precprime(n^2)) / 2 - n^2", "))
CROSSREFS
KEYWORD
sign
AUTHOR
Dimitris Valianatos, Dec 11 2020
STATUS
approved