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

 Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 59th year, we have over 358,000 sequences, and we’ve crossed 10,300 citations (which often say “discovered thanks to the OEIS”). Other ways to Give
 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A062022 a(n) = Sum_{k=1..n} Sum_{j=1..k} (prime(k) - prime(j))^2. 3
 0, 1, 14, 59, 256, 581, 1298, 2287, 4004, 7329, 11338, 17915, 26660, 36637, 49406, 67239, 91252, 117585, 151730, 191819, 235112, 289013, 350842, 425919, 521300, 628001, 740666, 865899, 997744, 1143501, 1345454, 1565639, 1815068, 2074761 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,3 LINKS G. C. Greubel, Table of n, a(n) for n = 1..1000 FORMULA From G. C. Greubel, May 04 2022: (Start) a(n) = a(n-1) + n*prime(n)^2 + Sum_{k=1..n} prime(k)*(prime(k) - 2*prime(n)), with a(0) = a(1) = 0. a(n) = n*Sum_{j=1..n} prime(j)^2 - (Sum_{j=1..n} prime(j))^2 = n*A024450(n) - A007504(n)^2. (End) EXAMPLE a(3) = (5-2)^2 + (5-3)^2 + (3-2)^2 = 14, sum of the squared differences of all pairs of the first 3 primes. MAPLE A062022 := proc(n) local a, i, j ; a := 0 ; for j from 1 to n do for i from 1 to j-1 do a := a+(ithprime(j)-ithprime(i))^2 ; end do: end do: a ; end proc: seq(A062022(n), n=1..10); # R. J. Mathar, Oct 03 2014 MATHEMATICA a[n_]:= a[n]= n*Sum[Prime[k]^2, {k, n}] - (Sum[Prime[j], {j, n}])^2; Table[a[n], {n, 50}] (* G. C. Greubel, May 04 2022 *) PROG (SageMath) @CachedFunction def a(n): return n*sum(nth_prime(j)^2 for j in (1..n)) - (sum(nth_prime(j) for j in (1..n)))^2 [a(n) for n in (1..50)] # G. C. Greubel, May 04 2022 CROSSREFS Cf. A000040, A007504, A024450, A062020, A062021. Sequence in context: A143861 A100174 A120371 * A277986 A261282 A158058 Adjacent sequences: A062019 A062020 A062021 * A062023 A062024 A062025 KEYWORD nonn AUTHOR Amarnath Murthy, Jun 02 2001 EXTENSIONS More terms from Matthew Conroy, Jun 11 2001 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.

Last modified November 29 15:30 EST 2022. Contains 358431 sequences. (Running on oeis4.)