OFFSET
1,4
COMMENTS
Equals 0 if p == 1 (mod 4).
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
Christian Aebi and Grant Cairns, Sums of Quadratic residues and nonresidues, arXiv preprint arXiv:1512.00896 [math.NT] (2015).
MAPLE
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
KEYWORD
sign
AUTHOR
N. J. A. Sloane, Feb 20 2017
STATUS
approved