Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #16 Nov 27 2017 10:41:39
%S 0,9,44,293,461,758,1022,1799,2530,3171,4778,5068,7662,8470,9993,
%T 14097,16674,19467,20755,25701,29042,34471,37506,40661,45066,48541,
%U 54324,54224,58135,60351,68593,75432,74014,83881,85900,98518,112000,117443,122241,132125,143322,151299,163180,161975,181191
%N Let p = n-th prime == 3 mod 8; a(n) = sum of quadratic residues mod p that are > p/2.
%H Jean-François Alcover, <a href="/A282722/b282722.txt">Table of n, a(n) for n = 1..1000</a>
%H Christian Aebi, Grant Cairns, <a href="http://arxiv.org/abs/1512.00896">Sums of Quadratic residues and nonresidues</a>, arXiv:1512.00896 [math.NT], 2015.
%p with(numtheory):
%p Ql:=[]; Qu:=[]; Q:=[]; Nl:=[]; Nu:=[]; N:=[]; Th:=[];
%p for i1 from 1 to 300 do
%p p:=ithprime(i1);
%p if (p mod 8) = 3 then
%p ql:=0; qu:=0; q:=0; nl:=0; nu:=0; n:=0;
%p for j from 1 to p-1 do
%p if legendre(j,p)=1 then
%p q:=q+j;
%p if j<p/2 then ql:=ql+j; else qu:=qu+j; fi;
%p else
%p n:=n+j;
%p if j<p/2 then nl:=nl+j; else nu:=nu+j; fi;
%p fi;
%p od;
%p Ql:=[op(Ql),ql];
%p Qu:=[op(Qu),qu];
%p Q:=[op(Q),q];
%p Nl:=[op(Nl),nl];
%p Nu:=[op(Nu),nu];
%p N:=[op(N),n];
%p Th:=[op(Th),q+ql];
%p fi;
%p od:
%p Ql; Qu; Q; Nl; Nu; N; Th; # A282721 - A282727
%p # 2nd program
%p A282722 := proc(n)
%p local p,ar;
%p p := A007520(n) ;
%p a := 0 ;
%p for r from (p+1)/2 to p do
%p if numtheory[legendre](r,p) = 1 then
%p a := a+r ;
%p end if;
%p end do:
%p a ;
%p end proc:
%p seq(A282722(n),n=1..10) ; # _R. J. Mathar_, Apr 07 2017
%t b[1] = 3; b[n_] := b[n] = Module[{p}, p = NextPrime[b[n - 1]]; While[Mod[p, 8] != 3, p = NextPrime[p]]; p];
%t a[n_] := Module[{p, q, r}, p = b[n]; q = 0; For[r = (p + 1)/2, r <= p, r++, If[KroneckerSymbol[r, p] == 1, q = q + r]]; q];
%t Array[a, 45] (* _Jean-François Alcover_, Nov 27 2017, after _R. J. Mathar_ *)
%Y Cf. A282035-A282043 and A282721-A282727.
%K nonn
%O 1,2
%A _N. J. A. Sloane_, Feb 20 2017