login
A282038
(Sum of the quadratic nonresidues of prime(n)) - (sum of the quadratic residues of prime(n)).
7
-1, 1, 0, 7, 11, 0, 0, 19, 69, 0, 93, 0, 0, 43, 235, 0, 177, 0, 67, 497, 0, 395, 249, 0, 0, 0, 515, 321, 0, 0, 635, 655, 0, 417, 0, 1057, 0, 163, 1837, 0, 895, 0, 2483, 0, 0, 1791, 633, 1561, 1135, 0, 0, 3585, 0, 1757, 0, 3419, 0, 2981, 0, 0, 849, 0, 921, 5909, 0, 0, 993, 0, 1735, 0, 0, 6821, 3303, 0
OFFSET
1,4
COMMENTS
Equals 0 if p == 1 (mod 4).
LINKS
Christian Aebi and Grant Cairns, Sums of Quadratic residues and nonresidues, arXiv preprint arXiv:1512.00896 [math.NT] (2015).
MAPLE
with(numtheory):
a:=[]; m:=[]; d:=[];
for i1 from 1 to 100 do
p:=ithprime(i1);
sp:=0; sm:=0;
for j from 1 to p-1 do
if legendre(j, p)=1 then sp:=sp+j; else sm:=sm+j; fi; od;
a:=[op(a), sp]; m:=[op(m), sm]; d:=[op(d), sm-sp];
od:
a; m; d; # A076409, A125615, A282038
MATHEMATICA
sum[p_] := Total[If[JacobiSymbol[#, p] == 1, -#, #]& /@ Range[p-1]];
a[n_] := sum[Prime[n]];
Array[a, 100] (* Jean-François Alcover, Aug 31 2018 *)
PROG
(PARI) a(n) = my (p=prime(n)); return (sum(i=1, p-1, if (kronecker(i, p)==1, -i, +i))) \\ Rémy Sigrist, Apr 28 2017
CROSSREFS
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.
Sequence in context: A123797 A123805 A124200 * A133346 A091920 A036934
KEYWORD
sign
AUTHOR
N. J. A. Sloane, Feb 20 2017
STATUS
approved