OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Aebi, Christian, and Grant Cairns. Sums of Quadratic residues and nonresidues, arXiv preprint arXiv:1512.00896 (2015).
MAPLE
with(numtheory):
Ql:=[]; Qu:=[]; Q:=[]; Nl:=[]; Nu:=[]; N:=[];
for i1 from 1 to 300 do
p:=ithprime(i1);
if (p mod 8) = 7 then
ql:=0; qu:=0; q:=0; nl:=0; nu:=0; n:=0;
for j from 1 to p-1 do
if legendre(j, p)=1 then
q:=q+j;
if j<p/2 then ql:=ql+j; else qu:=qu+j; fi;
else
n:=n+j;
if j<p/2 then nl:=nl+j; else nu:=nu+j; fi;
fi;
od;
Ql:=[op(Ql), ql];
Qu:=[op(Qu), qu];
Q:=[op(Q), q];
Nl:=[op(Nl), nl];
Nu:=[op(Nu), nu];
N:=[op(N), n];
fi;
od:
# alternative:
g:= proc(t, p) if t < p/2 then t else 0 fi end proc;
f:= proc(n) local k;
add(g(k^2 mod n, n), k=1..n/2)
end proc:
P:= select(isprime, [seq(i, i=7..3000, 8)]):
map(f, P); # Robert Israel, Nov 09 2020
MATHEMATICA
sum[p_]:= Total[If[#<p/2 && JacobiSymbol[#, p] != 1, #, 0]& /@ Range[p-1]];
sum /@ Select[Range[7, 1100, 8], PrimeQ] (* Jean-François Alcover, Aug 31 2018 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Feb 20 2017
STATUS
approved