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

 

Logo
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

%I #8 May 14 2022 04:57:26

%S 0,1,6,17,44,81,142,217,324,485,666,913,1208,1529,1906,2373,2936,3533,

%T 4238,5019,5840,6787,7822,8995,10360,11825,13342,14967,16648,18445,

%U 20662,23003,25536,28135,31074,34083,37308,40755,44354,48187,52260

%N a(n) = Sum_{i=1..n} Sum_{j=1..i} (prime(i) - prime(j)).

%H G. C. Greubel, <a href="/A062020/b062020.txt">Table of n, a(n) for n = 1..1000</a>

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

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

%F 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

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

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

%t Table[a[n], {n, 50}] (* _G. C. Greubel_, May 04 2022 *)

%o (SageMath)

%o @CachedFunction

%o def a(n): # A062020

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

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

%o [a(n) for n in (1..50)] # _G. C. Greubel_, May 04 2022

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

%K nonn

%O 1,3

%A _Amarnath Murthy_, Jun 02 2001

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

%E Name edited by _G. C. Greubel_, May 04 2022

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 August 31 18:44 EDT 2024. Contains 375573 sequences. (Running on oeis4.)