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!)
 A076409 Sum of the quadratic residues of prime(n). 18

%I

%S 1,1,5,7,22,39,68,76,92,203,186,333,410,430,423,689,767,915,1072,994,

%T 1314,1343,1577,1958,2328,2525,2369,2675,2943,3164,3683,3930,4658,

%U 4587,5513,5134,6123,6520,6012,7439,7518,8145,7831,9264,9653,8955,10761,11596

%N Sum of the quadratic residues of prime(n).

%C Row sums of A063987. - _R. J. Mathar_, Jan 08 2015

%C prime(n) divides a(n) for n > 2. This is implied by a variant of Wolstenholme's theorem (see Hardy & Wright reference). - _Isaac Saffold_, Jun 21 2018

%D G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 4th ed., Oxford Univ. Press, 1960, p. 88-90.

%D Kenneth A. Ribet, Modular forms and Diophantine questions, Challenges for the 21st century (Singapore 2000), 162-182; World Sci. Publishing, River Edge NJ 2001; Math. Rev. 2002i:11030.

%H Zak Seidov, <a href="/A076409/b076409.txt">Table of n, a(n) for n = 1..1000</a>

%H Christian Aebi and Grant Cairns, <a href="https://arxiv.org/abs/1512.00896">Sums of Quadratic residues and nonresidues</a>, arXiv preprint arXiv:1512.00896 [math.NT] (2015).

%F If prime(n) = 4k+1 then a(n) = k*(4k+1).

%F For n>2 if prime(n) = 4k+3 then a(n) = (k - b)*(4k+3) where b = (h(-p) - 1) / 2; h(-p) = A002143. For instance. If n=5, p=11, k=2, b=(1-1)/2=0 and a(5) = 2*11 = 22. If n=20, p=71, k=17, b=(7-1)/2=3 and a(20) = 14*71 = 994. - _AndrĂ©s Ventas_, Mar 01 2021

%e If n = 3, then p = 5 and a(3) = 1 + 4 = 5. If n = 4, then p = 7 and a(4) = 1 + 4 + 2 = 7. If n = 5, then p = 11 and a(5) = 1 + 4 + 9 + 5 + 3 = 22. - _Michael Somos_, Jul 01 2018

%p A076409 := proc(n)

%p local a,p,i ;

%p p := ithprime(n) ;

%p a := 0 ;

%p for i from 1 to p-1 do

%p if numtheory[legendre](i,p) = 1 then

%p a := a+i ;

%p end if;

%p end do;

%p a ;

%p end proc: # _R. J. Mathar_, Feb 26 2011

%t Join[{1,1}, Table[ Apply[ Plus, Flatten[ Position[ Table[ JacobiSymbol[i, Prime[n]], {i, 1, Prime[n] - 1}], 1]]], {n, 3, 48}]]

%t Join[{1}, Table[p=Prime[n]; If[Mod[p,4]==1, p(p-1)/4, Sum[PowerMod[k,2, p],{k,p/2}]], {n,2,1000}]] (* _Zak Seidov_, Nov 02 2011 *)

%t a[ n_] := If[ n < 3, Boole[n > 0], With[{p = Prime[n]}, Sum[ Mod[k^2, p], {k, (p - 1)/2}]]]; (* _Michael Somos_, Jul 01 2018 *)

%o (PARI) a(n,p=prime(n))=if(p<5,return(1)); if(k%4==1, return(p\4*p)); sum(k=1,p-1,k^2%p) \\ _Charles R Greathouse IV_, Feb 21 2017

%Y Cf. A076410.

%Y Sums of residues, nonresidues, and their differences, for p == 1 mod 4, p == 3 mod 4, and all p: A171555; A282035, A282036, A282037; A076409, A125615, A282038.

%K nonn,easy

%O 1,3

%A _R. K. Guy_, Oct 08 2002

%E Edited and extended by _Robert G. Wilson v_, Oct 09 2002

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 May 15 10:54 EDT 2021. Contains 343909 sequences. (Running on oeis4.)