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

 

Logo

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!)
A062020 a(n) = Sum_{i=1..n} Sum_{j=1..i} (prime(i) - prime(j)). 6
0, 1, 6, 17, 44, 81, 142, 217, 324, 485, 666, 913, 1208, 1529, 1906, 2373, 2936, 3533, 4238, 5019, 5840, 6787, 7822, 8995, 10360, 11825, 13342, 14967, 16648, 18445, 20662, 23003, 25536, 28135, 31074, 34083, 37308, 40755, 44354, 48187, 52260 (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

a(n) = a(n-1) + n*prime(n) - Sum_{i = 1..n} prime(i), with a(0) = 0.

a(n) = 2*a(n-1) - a(n-2) + (n-1)*(prime(n) - prime(n-1)), with a(1) = 0, a(2) = 1.

a(n) = Sum_{j=1..n} (2*j - (n+1))*prime(j) = 2*A014285(n) - (n+1)*A007504(n). - G. C. Greubel, May 04 2022

EXAMPLE

a(3) = (5-2) + (5-3) + (3-2) = 6.

MATHEMATICA

a[n_]:= a[n]= If[n<3, (n-1), 2*a[n-1] -a[n-2] +(n-1)*(Prime[n] -Prime[n-1])];

Table[a[n], {n, 50}] (* G. C. Greubel, May 04 2022 *)

PROG

(SageMath)

@CachedFunction

def a(n): # A062020

if (n<3): return (n-1)

else: return 2*a(n-1) - a(n-2) + (n-1)*(nth_prime(n) - nth_prime(n-1))

[a(n) for n in (1..50)] # G. C. Greubel, May 04 2022

CROSSREFS

Cf. A000040, A007504, A014285, A062021, A062022.

Sequence in context: A171507 A099858 A232567 * A066183 A262297 A048746

Adjacent sequences: A062017 A062018 A062019 * A062021 A062022 A062023

KEYWORD

nonn

AUTHOR

Amarnath Murthy, Jun 02 2001

EXTENSIONS

More terms from Larry Reeves (larryr(AT)acm.org), Jun 05 2001

Name edited by G. C. Greubel, May 04 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 November 29 16:32 EST 2022. Contains 358431 sequences. (Running on oeis4.)