login
A282039
Let p = n-th prime == 7 mod 8; a(n) = sum of quadratic residues mod p that are < p/2.
5
3, 33, 60, 138, 315, 390, 663, 1008, 1425, 1743, 2280, 2475, 3108, 3570, 4323, 4590, 6045, 8055, 8418, 9168, 11610, 12045, 13398, 14340, 14823, 15813, 22425, 23028, 24885, 26163, 32310, 33033, 34503, 35250, 42333, 43995, 46548, 49173, 51870, 52785, 58443, 60393, 61380, 66435, 67470, 70623
OFFSET
1,1
LINKS
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:
Ql; Qu; Q; Nl; Nu; N; # A282039, A282040, A282041, A282039 again, A282042, A282043
# 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