The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A062021 Let P(n) = { 2,3,5,7,...,p(n) } where p(n) is n-th prime; then a(1) =0 and a(n) = Sum [mod{p(i)^2 - p(j)^2}], for all i and j from 1 to n. 1

%I

%S 0,5,42,151,548,1185,2542,4403,7608,13621,20834,32535,47980,65609,

%T 88278,119947,162368,208869,269194,340007,416580,512305,622286,756003,

%U 925432,1114661,1314498,1537015,1771628,2031993,2393158,2786315

%N Let P(n) = { 2,3,5,7,...,p(n) } where p(n) is n-th prime; then a(1) =0 and a(n) = Sum [mod{p(i)^2 - p(j)^2}], for all i and j from 1 to n.

%H Robert Israel, <a href="/A062021/b062021.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = 2*a(n-1) + (n-1)*(p(n)^2-p(n-1)^2) - a(n-2)

%e a(3) = (5^2-2^2) + (5^2-3^2) + (3^2-2^2) = 42, P(3) = {2,3,5}.

%p N:= 100: # for a(1)..a(N)

%p P2:= [seq(ithprime(i)^2,i=1..N)]:

%p DP2:= P2[2..-1]-P2[1..-2]:

%p A[1]:= 0: A[2]:= 5:

%p for n from 3 to N do A[n]:= 2*A[n-1]+(n-1)*DP2[n-1]-A[n-2] od:

%p seq(A[i],i=1..N); # _Robert Israel_, Feb 02 2020

%t RecurrenceTable[{a[1]==0,a[2]==5,a[n]==2a[n-1]+(n-1)(Prime[n]^2-Prime[ n-1]^2)-a[n-2]},a,{n,40}] (* _Harvey P. Dale_, May 16 2019 *)

%K nonn

%O 1,2

%A _Amarnath Murthy_, Jun 02 2001

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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified September 29 04:55 EDT 2020. Contains 337420 sequences. (Running on oeis4.)