A065595 a(n) = (sum of first n primes)^2 - sum of squares of first n primes.
0, 12, 62, 202, 576, 1304, 2698, 4902, 8444, 14244, 22242, 34082, 50236, 70704, 97118, 131886, 176844, 230524, 297658, 378314, 471608, 584104, 715410, 870982, 1057804, 1271924, 1511090, 1781586, 2080464, 2414944, 2819566, 3270206
Offset: 1
Examples
a(4) = 202 because (2 + 3 + 5 + 7)^2 - (2^2 + 3^2 + 5^2 + 7^2) = 17^2 - (4 + 9 + 25 + 49) = 289 - 87 = 202
Links
- Harry J. Smith, Table of n, a(n) for n=1,...,500
Programs
-
Mathematica
With[{prs=Prime[Range[40]]},Table[Total[Take[prs,n]]^2-Total[Take[ prs,n]^2], {n,40}]] (* Harvey P. Dale, Dec 04 2011 *)
-
PARI
{ a1=a2=0; for (n=1, 500, a1+=prime(n); a2+=prime(n)^2; write("b065595.txt", n, " ", a1^2 - a2) ) } \\ Harry J. Smith, Oct 23 2009
Formula
Extensions
a(26)-a(32) from Harry J. Smith, Oct 23 2009
Comments