login
A282724
Let p = n-th prime == 3 mod 8; a(n) = sum of quadratic nonresidues mod p that are < p/2.
2
0, 2, 13, 94, 129, 247, 306, 555, 745, 999, 1579, 1555, 2466, 2653, 3059, 4581, 5430, 6351, 6658, 8409, 9087, 11158, 11996, 12858, 14814, 15788, 17880, 17277, 18950, 19481, 22400, 24876, 23518, 27448, 28115, 32285, 36743, 38269, 39851, 43111, 47406, 50055, 53683, 51645, 58274, 66410, 65119, 76013, 80465
OFFSET
1,2
LINKS
Jean-François Alcover, Table of n, a(n) for n = 1..1000
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:=[]; Th:=[];
for i1 from 1 to 300 do
p:=ithprime(i1);
if (p mod 8) = 3 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];
Th:=[op(Th), q+ql];
fi;
od:
Ql; Qu; Q; Nl; Nu; N; Th; # A282721 - A282727
# 2nd program
A282724 := proc(n)
local p, a, r;
p := A007520(n) ;
a := 0 ;
for r from 1 to (p-1)/2 do
if numtheory[legendre](r, p) <> 1 then
a := a+r ;
end if;
end do:
a ;
end proc:
seq(A282724(n), n=1..10) ; # R. J. Mathar, Apr 07 2017
MATHEMATICA
b[1] = 3; b[n_] := b[n] = Module[{p}, p = NextPrime[b[n - 1]]; While[Mod[p, 8] != 3, p = NextPrime[p]]; p];
a[n_] := Module[{p, q, r}, p = b[n]; q = 0; For[r = 1, r <= (p - 1)/2, r++, If[KroneckerSymbol[r, p] != 1, q = q + r]]; q];
Array[a, 50] (* Jean-François Alcover, Nov 27 2017, after R. J. Mathar *)
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Feb 20 2017
STATUS
approved